convert read in C to C#

G

Guest

Is there any equivalent in C# to this statement in C

read(fd,idxs,30*sizeof(unsigned int));

where idxs =(unsigned int *) calloc(30,sizeof(unsigned int)); ?

Bascially, I have an array of unsigned integers in C#. I would like to read
an array of bytes from a file an immediately insert it into the array idxs.
Is this possible?
 
R

Robbe Morris [C# MVP]

My C is real, real rusty. But the BinaryReader has overrides
to deal with specific byte placement.
 
J

John Davison

Mimi said:
Is there any equivalent in C# to this statement in C

read(fd,idxs,30*sizeof(unsigned int));

where idxs =(unsigned int *) calloc(30,sizeof(unsigned int)); ?

Bascially, I have an array of unsigned integers in C#. I would like to read
an array of bytes from a file an immediately insert it into the array idxs.
Is this possible?


If you want to read UInt32s, use BinaryReader's ReadUInt32.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top