This repository has been archived on 2026-05-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
prog-103-p-05-2030/Who_robbed_Thibouvre/fundamentals/print_lines/print_lines.c
T
2026-02-19 18:58:05 +01:00

35 lines
478 B
C

#include <stdio.h>
int print_lines(const char *filename){
FILE *file = fopen(filename);
if(!file) return 1;
// int c = fgetc(file);
int c = fgetc(file);
while(c != EOF){
while(c != '\0') printf("%c", c);
printf("\n");
}
return 0;
}
int main()
{
print_lines("example.txt");
/* Expected:
> First line
> Second line
> Third line
> and so on
>
> ^^^ Even empty lines ^^^
*/
return 0;
}