Top "Fgetc" questions

Anything related to C or C++ standard library functions `fgetc` (C) or `std::fgetc` (C++). These functions are used to read a single character from a stream.

C fgets versus fgetc for reading line

I need to read a line of text (terminated by a newline) without making assumptions about the length. So I …

c io stdio fgets fgetc
Counting number of lines in the file in C

I'm writing a function that reads the number of lines in the given line. Some text files may not end …

c file-io fgetc
Comparing unsigned char and EOF

when the following code is compiled it goes into an infinite loop: int main() { unsigned char ch; FILE *fp; fp = …

c comparison eof unsigned-char fgetc
fgetc, checking EOF

In the book Linux System Programming I have read some like this: fgetc returns the character read as an unsigned …

c eof fgetc
How do I get fgetc to print all the characters of a file inside of a loop

I'm playing around with fgetc and was wondering how I would get my loop to print the line section once …

c fgetc
Confusion with == EOF vs feof

I opened a file, the stream is found at the address of pointer ptr. I am attempting to see whether …

c file pointers fgetc feof
C- Checking if the first character in the first comand line arguement contains a particular char

If the first character of the first argument == "-" then enter the if statement. The error I get is "passing …

c pointers casting strcmp fgetc