69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main(int argc, char* argv[])
{
FILE* file;
char ch;
int count = 1;
file = fopen("8.txt", "r");
if(file == NULL)
{
return -1;
}
while(!feof(file))
{
ch = fgetc(file);
if(ch == 'k')
{
printf("%d\n", count);
}
count++;
}
fclose(file);
return 0;
}