Steward
分享是一種喜悅、更是一種幸福
程式語言 - GNU - C/C++ - Read File(Line by Line)
main.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
FILE *f = NULL;
char buf[255] = {0};
f = fopen("test.txt", "r");
while (fgets(buf, sizeof(buf), f)) {
printf("%s\n", buf);
}
fclose(f);
return 0;
}