如何使用fopen()? [英] how to use fopen()?

查看:74
本文介绍了如何使用fopen()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了以下程序:


#include< stdio.h>


main()

{

文件*文件;


file = fopen(d:\readme.txt," r");

if(file == NULL)

printf(他妈的不能正常工作);

else

printf( finaly);

}

我的问题是,唯一的程序''结果是:他妈的它不能正常工作

我错了什么?

I wrote following program:

#include <stdio.h>

main()
{
FILE *file;

file=fopen(d:\readme.txt,"r");
if (file==NULL)
printf("fuck it''s not working");
else
printf("finaly");
}
My problem is that the only programs'' result is : "fuck it''s not working"
What do I wrong?

推荐答案

文章< 91 **************** **********@posting.google.com> ;, Taras写道:
In article <91**************************@posting.google.com >, Taras wrote:
我写了以下程序:

#include< stdio.h> ;

main()


int main(无效)

{
文件*文件;

file = fopen(d:\readme.txt," r");
if(file == NULL)
printf(他妈的不能正常工作) ;
其他
printf(" finaly");


fclose(文件);

返回0;

}

我的问题是只有程序''结果是:'他妈的它'不工作'"
I wrote following program:

#include <stdio.h>

main()
int main(void)
{
FILE *file;

file=fopen(d:\readme.txt,"r");
if (file==NULL)
printf("fuck it''s not working");
else
printf("finaly");
fclose(file);
return 0;
}
My problem is that the only programs'' result is : "fuck it''s not working"




我怀疑它甚至是这样,你在线上有语法错误


file = fopen(d:\readme.txt," r");


尝试将其写成


file = fopen(" d:/readme.txt"," r");


代替,或者转义反斜杠:


file = fopen(" d:\\readme.txt"," r");

-

Andreas K?h?ri



I doubt it''s even that, you have a syntax error on the line

file=fopen(d:\readme.txt,"r");

Try writing it as

file = fopen("d:/readme.txt", "r");

instead, or escape the backslash:

file = fopen("d:\\readme.txt", "r");
--
Andreas K?h?ri




" Taras" < TE ***** @ o2.pl>在留言中写道

news:91 ************************** @ posting.google.c om ...

"Taras" <te*****@o2.pl> wrote in message
news:91**************************@posting.google.c om...
我写了以下程序:

#include< stdio.h>

main()
{
文件* file;

file = fopen(d:\readme.txt," r");


file = fopen(" d:\readme.txt"," r");

if(file == NULL)
printf(他妈的不行);

printf(finaly);
}

我的问题是唯一的程序''结果是:他妈的它不起作用
我错了什么?
I wrote following program:

#include <stdio.h>

main()
{
FILE *file;

file=fopen(d:\readme.txt,"r");
file=fopen("d:\readme.txt", "r");
if (file==NULL)
printf("fuck it''s not working");
else
printf("finaly");
}
My problem is that the only programs'' result is : "fuck it''s not working"
What do I wrong?








Fao,Sean <恩********** @ yahoo.comI-WANT-NO-SPAM>在消息中写道

news:rK ******************** @ news1.news.adelphia.ne t ...

"Fao, Sean" <en**********@yahoo.comI-WANT-NO-SPAM> wrote in message
news:rK********************@news1.news.adelphia.ne t...

Taras < TE ***** @ o2.pl>在消息中写道
新闻:91 ************************** @ posting.google.c om ...

"Taras" <te*****@o2.pl> wrote in message
news:91**************************@posting.google.c om...
我写了以下程序:

#include< stdio.h>

main()
{
FILE *文件;

file = fopen(d:\readme.txt," r");
I wrote following program:

#include <stdio.h>

main()
{
FILE *file;

file=fopen(d:\readme.txt,"r");



file = fopen(" d:\readme.txt" ;," r");



file=fopen("d:\readme.txt", "r");

if(file == NULL)
printf(他妈的不能正常工作);
else
printf(finaly);


/ *哎呀,我错过了这个* /

fclose(文件);

返回0;

}
if (file==NULL)
printf("fuck it''s not working");
else
printf("finaly");
/* Oops, I missed this */
fclose(file);
return 0;
}






这篇关于如何使用fopen()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆