请问在C++中如何读文件,并把我需要的内容写到另外一个文件,谢谢

wxfnj 2003-11-14 06:00:50
请问在C++中如何读文件,并把我需要的内容写到另外一个文件,谢谢
...全文
50 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxfnj 2003-11-14
比如,我如何
WHI RELEASE: whi_I_19.1.0
SID: 1.2; module:spactrig19.t; last chg: 08/27/02 15:38:05
Report for Hours: 0 - 23



CDN PEAK HOURLY PROC OCCUP: Limit (for 15 CDN's) is 79%, Warning (<) at 67%
CDNIII-1(34%) CDNIII-2(38%) CDNIII-3(34%) CDNIII-4(34%) CDNIII-5(34%) CDNIII-6(34%) CDNIII-7(34%) CDNIII-8(34%) CDNIII-9(34%) CDNIII-10(34%) CDNIII-11(34%) CDNIII-12(34%) CDNIII-13(34%) CDNIII-14(34%) CDNIII-15(34%)


DLN PEAK HOURLY PROC OCCUP: Limit is 80%, Warning (<) at 68%.
DLN60 - 1 (4%) DLN60 - 2 (19%)


CSN PEAK HOURLY PROC OCCUP for top 4 of 0 pairs: Limit is 80%, Warning (<) at 65%
0 ( 0%) 0 ( 0%) 0 ( 0%) 0 ( 0%)


SS7 LN PEAK HOURLY DL USAGE for top 4 of 34 links: Limit is 40%, Warning (<) at 32%
SS7 LN00-03 (21%) SS7 LN00-05 (21%) SS7 LN00-09 (21%) SS7 LN00-10 (21%)


CELL DATA LINK PEAK HOURLY OCCUP for 5 cells: Limit is 70%, Warning (<) at 57%
1) Occupancy calculations assume 56 kbps link.
2) If your link is 9.6 kbps multiply values by 6 for actual occupancy
CELL0(0%) CELL0(0%) CELL0(0%) CELL0(0%) CELL0(0%)

读出
CDN PEAK HOURLY PROC OCCUP: Limit (for 15 CDN's) is 79%, Warning (<) at 67%
CDNIII-1(34%) CDNIII-2(38%) CDNIII-3(34%) CDNIII-4(34%) CDNIII-5(34%) CDNIII-6(34%) CDNIII-7(34%) CDNIII-8(34%) CDNIII-9(34%) CDNIII-10(34%) CDNIII-11(34%) CDNIII-12(34%) CDNIII-13(34%) CDNIII-14(34%) CDNIII-15(34%)

回复
wxfnj 2003-11-14
请问如何对内容判断?
回复
zhouqingyuan 2003-11-14
在读的过程中可以对内容进行判断的。
回复
liulang203 2003-11-14
c++的内容忘的差不多了,不好意思啊
回复
soulz 2003-11-14
copy函数
# include<iostream.h>
# include<fstream.h>
# include<process.h>

void main(int argc,char *argv[] )
{
char ch;
if( argc != 3 ){
cout<<"Error:The argc is not enough!"<<endl;
exit( -1 );
}
ifstream source;
ofstream dest;
source.open ( argv[1],ios::nocreate );//源文件必须已经存在
if( !source ){
cout<<"Error:Can not open source file!"<<endl;
exit( -1 );
}
dest.open( argv[2] );
if( !dest ){
cout<<"Error:Can not open dest file!"<<endl;
exit( -1 );
}
while( dest && source.get( ch ) ){
dest.put( ch );
}
cout<<"The work has been completed!"<<endl;
source.close ();
dest.close();
}
回复
发动态
发帖子
C++ 语言
创建于2007-09-28

5.9w+

社区成员

C++ 语言相关问题讨论,技术干货分享,前沿动态等
申请成为版主
社区公告
暂无公告