33,311
社区成员
发帖
与我相关
我的任务
分享
FILE *fp;
int i = 1;
if ((fp = fopen(strGcp, "rt+")) == NULL)
{
printf("Open GCP falied:\n%s\n", strGcp);
return FALSE;
}
do
{
char strTemp[1000];
fgets(strTemp, 1000, fp);
char*Ps = strchr(strTemp, 'c');
char*str=strchr(strTemp, ' ');
if (Ps == NULL)continue;//跳过第一行
sprintf(strTemp, "cm_%d_%d%s",n, i, str);
fprintf(fp, "%s\n", strTemp);
printf("替换第%d行\n",i );
i++;
if (feof(fp)) break;
} while (true);
fclose(fp);
return TRUE;
}