在 C 中读取 txt 文件并将解析的字符串保存到数组中可以使用 fopen() 和 fscanf() 函数。代码示例如下:
```c #include <stdio.h>
int main() { char str[100]; FILE *fp = fopen("example.txt", "r"); int i = 0; while(fscanf(fp, "%s", str) != EOF) { printf("%s\n", str); i++; } fclose(fp); return 0; } `