读取txt数据
如何读取并存储C语言中的txt数据?
“c,#include,#includeint main() {, FILE file = fopen(“data.txt”, “r”);, if (file == NULL) {, perror(“Failed to open file”);, return EXIT_FAILURE;, } char buffer[256];, while (fgets(buffer, sizeof(buffer), file)) {, printf(“%s”, buffer);, } fclose(file);, return 0;,},“