| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 666 人关注过本帖
标题:关于文件操作的问题!急急急!
只看楼主 加入收藏
唏嘘草
Rank: 2
等 级:论坛游民
帖 子:128
专家分:93
注 册:2011-6-4
结帖率:88.24%
收藏
已结贴  问题点数:13 回复次数:5 
关于文件操作的问题!急急急!
急!求解惑!
问题错误提醒是

F:\我的课件\C语言\c++文件存放处\1\1.cpp(15) : error C2227: left of '->_flag' must point to class/struct/union
F:\我的课件\C语言\c++文件存放处\1\1.cpp(15) : fatal error C1903: unable to recover from previous error(s); stopping compilation
#include<stdio.h>
#include<stdlib.h>
int main()
{char c;
FILE *inflie,*outfile;
if((infile=fopen("f:\\呵呵.txt","r"))==NULL)
{printf("cannot open");
  exit(0);
}

if((outfile=fopen("f:\\呵呵副本.txt","w"))==NULL)
{printf("cannot open");
  exit(0);

while(!feof(infile))
{   c=fgetc(infile);
     fputc(c,outfile);


}


fclose(infile);
fclose(outfile);




return 0;
}


[ 本帖最后由 唏嘘草 于 2011-10-15 22:14 编辑 ]
搜索更多相关主题的帖子: 课件 C语言 point 
2011-10-15 21:55
nomify
Rank: 5Rank: 5
等 级:职业侠客
帖 子:79
专家分:366
注 册:2011-10-13
收藏
得分:13 
程序代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
    char c;
    FILE *infile,*outfile;
    if((infile=fopen("f:\\呵呵.txt","r"))==NULL)
    {
        printf("cannot open");
        exit(0);
    }
    if((outfile=fopen("f:\\呵呵副本.txt","w"))==NULL)
    {
        printf("cannot open");
        exit(0);
    }
    while(!feof(infile))
    {  
        c=fgetc(infile);
        fputc(c,outfile);
    }
    fclose(infile);
    fclose(outfile);

    return 0;
}

2011-10-15 22:20
唏嘘草
Rank: 2
等 级:论坛游民
帖 子:128
专家分:93
注 册:2011-6-4
收藏
得分:0 
回复 2楼 nomify
什么意思啊!看不出呢!
2011-10-15 22:25
nomify
Rank: 5Rank: 5
等 级:职业侠客
帖 子:79
专家分:366
注 册:2011-10-13
收藏
得分:0 
FILE *inflie   写错啦! infile
2011-10-15 22:33
nomify
Rank: 5Rank: 5
等 级:职业侠客
帖 子:79
专家分:366
注 册:2011-10-13
收藏
得分:0 
还少了一个 }
2011-10-15 22:34
唏嘘草
Rank: 2
等 级:论坛游民
帖 子:128
专家分:93
注 册:2011-6-4
收藏
得分:0 
解释下啊,出现这种问题真的真的很纠结啊 !
1。定义文件指针的时候,infile被写成了inflie
2.第二个IF判断少了一个一个花括号

真是悲剧啊!
2011-10-15 22:38
快速回复:关于文件操作的问题!急急急!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012071 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved