//在c语言环境下实现 C++中的getline函数 即在c语言中按行读取
FILE * fp;
char * send_msg = NULL;
size_t len = 0;
ssized_t read;
while ((read = getline(&send_msg, &len, fp)) != -1)
{
printf("%s\n",send_msg);
count++;
send_msg = NULL;
printf("共计 %d \n ",count);
if(read == -1)
breek;
}

本文介绍如何在C语言环境中实现类似C++ getline的功能,通过使用标准输入输出库中的getline函数按行读取文件内容,并展示了完整的代码示例。
3683

被折叠的 条评论
为什么被折叠?



