字符型文件写入

#include <stdio.h>


int main(void)
{
FILE *fp;   //fopen_s(&stream,"crt_fopen_s.c","r");  
errno_t err;
err = fopen_s(&fp,"C:\\Users\\Administrator\\Desktop\\jg\\拒登率&登录时间.txt", "w+"); //读取11.txt的文件  
int i = 0;
int a=52;
char ch[111111111];
sprintf(ch, "%s%d", "测试次数:", a);
//char ch[] = " 测试次数:52 \n拒登次数: 0 \n测试时间: 9.375000 秒\n平均时间: 0.180288 秒\n拒登图像:";
while (!feof(fp))
{
// printf("du");  
printf("%c", fgetc(fp));//每次获取一个字符  
}
while (ch[i++] != '\0')
{
fputc(ch[i], fp);
}
fclose(fp);
}

猜你喜欢

转载自blog.csdn.net/hk121/article/details/80202631