Pointers in C with binary file

Posted by darkie15 on Stack Overflow See other posts from Stack Overflow or by darkie15
Published on 2010-04-05T20:33:47Z Indexed on 2010/04/05 20:43 UTC
Read the original article Hit count: 135

Filed under:
|
|

Hi All,

I am reading the contents of the file using fread into an char array. But I am not sure why it is not getting printed in the output. Here is the code:

void getInfo(FILE* inputFile)
{
   char chunk[4];
   int liIndex;
   for (liIndex = 0 ; liIndex < 4 ; liIndex++)
   {
      fread(chunk, sizeof(char), 4, inputFile);
   }
   printf("\n chunk %s", chunk);
}

Output prints nothing at all. Where am I going wrong?

Regards , darkie

© Stack Overflow or respective owner

Related posts about c

    Related posts about homework