求救:C++中如何把文本文件PTtree.txt的内容存储在一个字符串数组中。请大家帮帮忙 万分感激啊

[复制链接]
查看11 | 回复1 | 2013-5-11 15:47:08 | 显示全部楼层 |阅读模式
用getline()读取来后放在一个数组里面就可以了#include #include #include #include using namespace std;int main(int argc, char *argv[]){ifstream infile;char filename[] = "PTtree.txt";string buf[] = "\0";infile.open(filename, fstream::in);for(int i = 0; getline(infile,buf);i++){coutvecp;vecp.push_back(readline());差不多就这样了,利用下现有的C++库,读一下,存一下。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行