| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 402 人关注过本帖
标题:[求助]c++的问题
只看楼主 加入收藏
cl_zdl
Rank: 1
等 级:新手上路
威 望:1
帖 子:71
专家分:0
注 册:2006-10-11
收藏
 问题点数:0 回复次数:2 
[求助]c++的问题
为什么下面的函数中if()语句不能运行,而是去运行else中的语句呢?
#include<iostream>
#include<fstream>
using namespace std;
void main()
{
char ch;
ifstream tfile ("payroll",ios_base::binary);
if(tfile)
{
while(tfile.good())
{ streampos here=tfile.tellg();
tfile.get(ch);
if(ch==' ')
cout<<"Position "<<here<<"is s space"<<endl;
}
}
else
cout<<"ERROR:Cannot open file 'payroll'."<<endl;
tfile.close();
}

搜索更多相关主题的帖子: include payroll 
2006-11-13 12:34
jiayuaqing
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-11-12
收藏
得分:0 

你的c++文件目录下没有“payroll“这个文件

2006-11-13 13:18
cl_zdl
Rank: 1
等 级:新手上路
威 望:1
帖 子:71
专家分:0
注 册:2006-10-11
收藏
得分:0 
ifstream tfile ("payroll",ios_base::binary);
这不是创建了个流输入对象吗?为什么还没有呢?

2006-11-14 13:11
快速回复:[求助]c++的问题
数据加载中...
 
   



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

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