#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
const char *board_list = "./example_list.txt";
int main(int argc, char **argv)
{
FILE *f = fopen(board_list, "rt");
for (;;)
{
char buf[1024];
if (!fgets(buf, sizeof(buf) - 3, f))
break;
size_t len = strlen(buf);
while (len > 0 && isspace(buf[--len]));
buf[len+1] = '\0';
cout<<buf<<endl;
}
return 0;
}
C++读取txt文件里每行的数据
最新推荐文章于 2024-03-28 18:47:44 发布