It's there automatically.
Now depending on the data in the file, the following could occur:
... /* Assume fIn is initialized and pointing to a valid file for reading. */
fgets(szBuffer, sizeof(szBuffer), fIn);
- A '\n' will be the last character read from the file and stored in szBuffer (not counting a '\0', which is automatically appended by fgets())
- The line length will be greater than the size of the buffer, so no '\n' will be stored, and only the first part of the line that can fit inside the buffer will be stored.
- Something went wrong with reading (perhaps the end of the file was reached), and fgets() will return NULL. You could then figure out why it returned NULL with usage of feof(), ferror(), and such.
In the first case, the next call to fgets() will start on the next line. Similarly, in the second case, fgets() will begin right where it left off, which was somewhere in the middle of the line. In the last case, you should not call fgets() again for that file unless you know what you're doing.