Create print.c

This commit is contained in:
ChenKaiLiuG
2025-04-01 00:46:56 +08:00
committed by GitHub
parent d70734dff7
commit a8302b1244

23
print.c Normal file
View File

@@ -0,0 +1,23 @@
// Under debugging
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
FILE *file;
char filename[] = "找找自己問題.txt";
char line[256];
file = fopen(filename, "r");
if (file == NULL) {
perror("無法開啟檔案");
return 1;
}
while (fgets(line, sizeof(line), file) != NULL) {
printf("%s", line);
}
fclose(file);
return 0;
}