void test1()
{
FILE *fp = fopen("1.txt", "w");
if (fp == NULL)
{
printf("fopen err\n");
return;
}
char buf[1000];
int i = 0;
while (1)
{
fgets(buf, sizeof(buf), stdin);
if (strncmp(buf, ":wq", 3) == 0)
{
break;
}
fputs(buf, fp);
}
//while (buf[i] != 0)
//{
// fputc(buf[i], fp);
// i++;
//}
}
C语言简单实现vi命令
最新推荐文章于 2022-09-10 15:41:49 发布