| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4466 人关注过本帖
标题:fopen("F:\1.txt","r")为什么会打开失败呢
取消只看楼主 加入收藏
swy147900
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-10-4
结帖率:100%
收藏
已结贴  问题点数:2 回复次数:2 
fopen("F:\1.txt","r")为什么会打开失败呢



#include "stdio.h"
#include "conio.h"



{
    FILE *fo;
    fo=fopen("F:\sun\1.txt","r");
    if(fo==NULL)
    {
        printf("failed to open the file");
    }
    else
    {
        printf("congratulations!");
        fclose(fo);
    }
        getch();
 }******************************************
#include "Stdio.h"
main()
{
     char a[20];
     FILE *fp;
     printf("enter name of file:");
     scanf("%s",a);
     fp=fopen(a,"r");
     if(fp==NULL)
     {
          printf("can't open this file:%s",a);
          exit(0);
     }else
    {
        printf("Congratulations!The file %s is opened!",a);
        fclose(fp);
    }
    getch();
}


这样为什么输入F:\sun\1.txt就没有错误了呢
*************************
搜索更多相关主题的帖子: 失败 fopen 
2009-10-04 21:39
swy147900
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-10-4
收藏
得分:0 
回复 2楼 StarWing83
谢谢了果然如此,O(∩_∩)O哈哈~,那为什么在命令提示符下输入F:\sun\1.txt就好使了呢
2009-10-04 21:47
swy147900
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-10-4
收藏
得分:0 
为啥没人回答了呢....
2009-10-04 22:01
快速回复:fopen("F:\1.txt","r")为什么会打开失败呢
数据加载中...
 
   



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

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