husunzhong 发表于 2014-8-4 10:16:34

求解答 为什么有一个错误??

#include<stdio.h>
#include<stdlib.h>

void main()
{
      FLIE *f_pic, *f_file, *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_flie=fopen(file_name,"rb"))
      {
            printf("Cannot open the pile %s!",file_name);

            return;
      }

   if(!f_finish=fopen(finish_name,"wb"))
      {
            printf("Cannot open the pile %s!",finish_name);

            return;
      }

   while(!(feof(f_pic)))
   {
         ch=fgetc(f_pic);

         fputc(ch,f_finish);
   }

   fclose(f_pic);

   while(!(feof(f_flie)))
   {
         ch=fgetc(f_file);

         fputc(ch,f_finish);
   }

   fclose(f_file);

   fclose(f_finish);

   system("pause");
}

错误是:E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2065: 'FLIE' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2065: 'f_pic' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2065: 'f_file' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2100: illegal indirection
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2065: 'f_finish' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(6) : error C2100: illegal indirection
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(8) : error C2143: syntax error : missing ';' before 'type'
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(14) : error C2065: 'pic_name' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(18) : error C2065: 'file_name' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(22) : error C2065: 'finish_name' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(24) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(24) : warning C4024: 'fopen' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(24) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _iobuf *'
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(24) : error C2106: '=' : left operand must be l-value
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(31) : error C2065: 'f_flie' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(31) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(31) : warning C4024: 'fopen' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(31) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _iobuf *'
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(31) : error C2106: '=' : left operand must be l-value
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(38) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(38) : warning C4024: 'fopen' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(38) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _iobuf *'
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(38) : error C2106: '=' : left operand must be l-value
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(45) : error C2223: left of '->_flag' must point to struct/union
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(47) : error C2065: 'ch' : undeclared identifier
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(47) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(47) : warning C4024: 'fgetc' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(49) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(49) : warning C4024: 'fputc' : different types for formal and actual parameter 2
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(52) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(52) : warning C4024: 'fclose' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(54) : error C2223: left of '->_flag' must point to struct/union
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(56) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(56) : warning C4024: 'fgetc' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(58) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(58) : warning C4024: 'fputc' : different types for formal and actual parameter 2
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(61) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(61) : warning C4024: 'fclose' : different types for formal and actual parameter 1
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(63) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
E:\visual c\MSDev98\MyProjects\bbb\bbb.c(63) : warning C4024: 'fclose' : different types for formal and actual parameter 1
执行 cl.exe 时出错.

牡丹花下死做鬼 发表于 2014-8-4 10:39:34

{:7_176:}
你违规了2. 代码大于20行以上时,最好写清自己的思路和注释,这样回答的人才能尽快给大家答案!(避免扔上一大堆代码,说是有错误,请人指点!)

oggplay 发表于 2014-8-4 10:57:41

本帖最后由 oggplay 于 2014-8-4 11:15 编辑


你打错了个别单词,我改了一下,能编译通过,不过我没看算法!
#include <stdio.h>
#include <stdlib.h>

int main()
{
      FILE *f_pic, *f_file, *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(!fopen(pic_name,"rb"))
      {
            printf("Cannot open the picture %s !\n",pic_name);

            return -1;
      }
      f_pic=fopen(pic_name,"rb");

      if(!fopen(file_name,"rb"))
      {
      printf("Cannot open the pile %s!\n",file_name);

            return -1;
      }
      f_file=fopen(file_name,"rb");


   if(!fopen(finish_name,"wb"))
      {
            printf("Cannot open the pile %s!\n",finish_name);

            return -1;
      }
   f_finish=fopen(finish_name,"wb");
      


   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);
   return 0;
}



页: [1]
查看完整版本: 求解答 为什么有一个错误??