When using fgetc
, fputc
, fgets
and fputs
for a file, do I need to ensure that I have open
ed the file in text mod
No. All stdio input and output functions are defined in terms of repeated calls to fgetc
or fputc
. Aside from POSIX requirements on top (mainly locking being for the whole larger operation rather than at the individual fgetc
/fputc
granularity), there is no difference between calling fputc
or fgetc
in a loop yourself, or doing the equivalent with fwrite
or fread
.
If the C implementation you use treats text files differently from binary, that treatment applies no matter which functions you use to perform the operations.