Top "Fgets" questions

Anything related to C or C++ standard library functions `fgets` (C) or `std::fgets` (C++). These functions are used to read a sequence of characters from an input stream and to write it into a character buffer as a string.

Difference between fgets and fscanf?

I have a question concerning fgets and fscanf in C. What exactly is the difference between these two? For example: …

c fgets scanf
Return value of fgets()

I have just recently started working with I/O in C. Here is my question - I have a file, …

c io fgets
PHP - Returning the last line in a file?

I'm guessing it's fgets, but I can't find the specific syntax. I'm trying to read out (in a string I'm …

php syntax fread fgets
fgets() includes the newline at the end

fgets(input,sizeof(input),stdin); if (strcmp(input, "quit") == 0){ exit(-1); } If I type quit, it does not exit the …

c string fgets
fgets() function in C

I know everybody has told me to use fgets and not gets because of buffer overflow. However, I am a …

c stdin fgets libc
Reading text-file until EOF using fgets in C

what is the correct way to read a text file until EOF using fgets in C? Now I have this (…

c while-loop fgets
fgets() and fread() - What is the difference?

I understand the differences between fgets() and fgetss() but I don't get the difference between fgets() and fread(), can someone …

php smtp stream fread fgets
Does fgets() always terminate the char buffer with \0?

Does fgets() always terminate the char buffer with \0 even if EOF is already reached? It looks like it does (it …

c fgets
C++: Store read binary file into buffer

I'm trying to read a binary file and store it in a buffer. The problem is, that in the binary …

c++ buffer fgets null-terminated
How do I read white space using scanf in c?

Problem: I need to be able identify when two whitespaces occur consecutively. I have read the following questions: how to …

c whitespace scanf fgets