读书人

这是小弟我编的程序为什么运行之后

发布时间: 2012-02-19 19:43:39 作者: rapoo

这是我编的程序,为什么运行之后,文件中没有写入任何数据
这是我编的程序,为什么运行之后,文件中没有写入任何数据
在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);
}

读书人网 >C语言

热点推荐