谁帮我改一下这段代码错误
本帖最后由 风之残月 于 2014-11-10 10:13 编辑#include<stdio.h>
#include<stdlib.h>
void main()
{
FILE *f_pic, *f_finish;
char ch,pic_name, file_name,finish_name;
printf("请输入需要合成的图片和文件的名称: \n");
printf("图片: ");
scanf("%s", pic_name);
printf("文件: ");
scanf("%s",file_name);
printf("生成为: ");
scanf("%s",finish_name);
if(!(f_pic = fopen(pic_name,"rb")))
{
printf("Cannot open the picture %s !",pic_name);
return;
}
if(!(f_file =fopen(file_name,"rb")))
{
printf("Cannot open the file %s !",file_name);
return;
}
if(!(f_finish = fopen(finish_name,"wb")))
{
printf("Cannot open the file %s!",finish_name);
return;
}
while(!(feof(f_pic)))
{
ch = fgetc(f_pic);
fputc(ch,f_finish);
}
fclose(f_pic);
while(!(feof(f_file)))
{
ch =fgetc(f_file);
fpuc(ch,f_finish);
}
fclose(f_file);
fclose(f_finish);
system("pause")
}
f_file 没有定义 ,应该 FILE *f_pic, *f_finish, *f_file; 或换行定义 FILE *f_file;
fpuc(ch,f_finish); 这句 "fputc" 写成了 "fpuc"
system("pause") 没有以 ; 结尾 风之残月 发表于 2014-6-17 10:03 static/image/common/back.gif
f_file 没有定义 ,应该 FILE *f_pic, *f_finish, *f_file; 或换行定义 FILE *f_file;
fpuc(ch,f_finish);...
那个你直接在原文上帮我改发一下吧 谢谢你了啊 新手! #include<stdio.h>
#include<stdlib.h>
void main()
{
FILE *f_pic, *f_finish, *f_file;
char ch,pic_name, file_name,finish_name;
printf("请输入需要合成的图片和文件的名称: \n");
printf("图片: ");
scanf("%s", pic_name);
printf("文件: ");
scanf("%s",file_name);
printf("生成为: ");
scanf("%s",finish_name);
if(!(f_pic = fopen(pic_name,"rb")))
{
printf("Cannot open the picture %s !",pic_name);
return;
}
if(!(f_file =fopen(file_name,"rb")))
{
printf("Cannot open the file %s !",file_name);
return;
}
if(!(f_finish = fopen(finish_name,"wb")))
{
printf("Cannot open the file %s!",finish_name);
return;
}
while(!(feof(f_pic)))
{
ch = fgetc(f_pic);
fputc(ch,f_finish);
}
fclose(f_pic);
while(!(feof(f_file)))
{
ch =fgetc(f_file);
fputc(ch,f_finish);
}
fclose(f_file);
fclose(f_finish);
system("pause");
} 很不错,很值得学习和借鉴 #include<stdio.h>
#include<stdlib.h>
void main()
{
FILE *f_pic, *f_finish, *f_file;
char ch,pic_name, file_name,finish_name;
printf("请输入需要合成的图片和文件的名称: \n");
printf("图片: ");
scanf("%s", pic_name);
printf("文件: ");
scanf("%s",file_name);
printf("生成为: ");
scanf("%s",finish_name);
if(!(f_pic = fopen(pic_name,"rb")))
{
printf("Cannot open the picture %s !",pic_name);
return;
}
if(!(f_file =fopen(file_name,"rb")))
{
printf("Cannot open the file %s !",file_name);
return;
}
if(!(f_finish = fopen(finish_name,"wb")))
{
printf("Cannot open the file %s!",finish_name);
return;
页:
[1]