[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File I/O





Hi,

>this might be a little off topic but... :)

>how can I read individual bytes from a file and push the value into a char
>variable?
>ie read the second byte of a file then push it in char secondByte




man fgetc
man fseek

Example:

file = fopen( "/etc/passwd", "rb" );
fseek( file, 1L, SEEK_SET );
secondByte = fgetc( file );
fclose( file );

ciao
Anti
---
http://webhome.nu/
Choice of a NU-Generation