Reading and Writing Files in C — a practical guide to C file read write with clear examples you can reuse in real projects.
C Programming Tutorial Series (75/102). Prefer one article? Read the complete C programming tutorial.
Short description
Prefer fgets over gets (gets is removed/unsafe).
fgets
char line[256];
while (fgets(line, sizeof line, fp)) {
fputs(line, stdout);
}