首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

这是小弟我编的程序,为什么运行之后,文件中没有写入任何数据

2012-02-19 
这是我编的程序,为什么运行之后,文件中没有写入任何数据这是我编的程序,为什么运行之后,文件中没有写入任

这是我编的程序,为什么运行之后,文件中没有写入任何数据
这是我编的程序,为什么运行之后,文件中没有写入任何数据
在tc下
#include <stdio.h>
main()
{FILE   *in,*out;
if(in=fopen( "c:\\rchf.txt ", "r ")==0)
  printf( "\ncannot   open   the   file\n ")   ;
if(out=fopen( "c:\\rchf1.txt ", "w ")==0)
  printf( "\ncannot   open   the   file\n ")   ;

  while(!feof(in))
  fputc(fgetc(in),out);
  fclose(in);
  fclose(out);
  }
我就是想问一下if(in=fopen( "c:\\rchf.txt ", "r ")==0)
                                                        此处该如何写路径      




[解决办法]
in=fopen( "c:\\rchf.txt ", "r ")==0
out=fopen( "c:\\rchf1.txt ", "w ")==0
===============================
(in=fopen( "c:\\rchf.txt ", "r "))==0
(out=fopen( "c:\\rchf1.txt ", "w "))==0
[解决办法]
#include <stdio.h>
main()
{
FILE *in,*out;
if((in=fopen( "c:\\rchf.txt ", "r "))==NULL)
printf( "\ncannot open the file\n ") ;
if((out=fopen( "c:\\rchf1.txt ", "w "))==NULL)
printf( "\ncannot open the file\n ") ;

while(!feof(in))
fputc(fgetc(in),out);
fclose(in);
fclose(out);
}

热点排行