标题:文件的读入
只看楼主
撒旦
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2007-6-1
 问题点数:0 回复次数:3 
文件的读入

怎样将一个文件夹读入程序啊

搜索更多相关主题的帖子: 文件 
2007-06-07 20:13
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
读文件夹?
文件吧?

Fight  to win  or  die...
2007-06-07 22:29
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
得分:0 
read file ?
for example:
#include<iostream>
#include<fstream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
fstream fin;
fin.open("d:\\filename.txt"); //the file path
if(fin.is_open()==false)
{
cerr<<"Can not open file,bye!\n";
exit(EXIT_FALLURE);

}
string item;
int count=0;
getline(fin,item,':');
while(fin){
count++;
cout<<count<<":"<<item<<endl;
getline(fin,item,':');
}
cout<<"done!"<<endl;
fin.close();



return 0;

}


Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-06-07 23:25
撒旦
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2007-6-1
得分:0 

谢谢


2007-06-08 13:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-145769-1-1.html




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

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