c# - c 将文本文件逐行读入数组并打印

标签 c# c arrays file

我有以下 C# 代码片段

string[] lines = File.ReadAllLines(@"C:\test.txt");
for(int i=0; i<lines.Length; i++)
    Console.WriteLine(lines[i]);

你能帮我把它转换成 C 语言吗?

谢谢!

最佳答案

如果您计划使用 Ansi 标准 C,您将需要 fopenfgetsprintf 来执行您想要的操作。

这是 a tutorial that does almost exactly what you want .

关于c# - c 将文本文件逐行读入数组并打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1910618/

相关文章:

javascript - json 数组,数组中返回错误?错误的字符串

c# - 如何从系统服务自动检测代理设置

c# - 当对象具有集合属性时投影 IQueryable<object> 时 Automapper 失败

c# - 强制依赖属性需要什么?

c - 将相同的文本添加到 C 文件中每一行的末尾

c - 我的链表未填充 C

c# - ZeroMQ CLRZMQ - 轮询套接字

c - 特定于线程的数据

python - 如何在python中缩短浮点结果

javascript - jQuery 'unique' 在 Safari 中不返回实际的唯一值