Re: [問題] 如何撰寫檔案拷貝程式
※ 引述《funnydark07 (秋華)》之銘言:
: 開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
: 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
: 問題(Question):
: 餵入的資料(Input):
: 預期的正確結果(Expected Output):
: 錯誤結果(Wrong Output):
: 程式碼(Code):(請善用置底文網頁, 記得排版)
: 補充說明(Supplement):
: 目前要寫一個檔案拷貝的程式
: 但必須要用格式化輸入和輸出來寫..
: 無從下手= = 有哪位大哥給個意見嗎!?
: /
也沒幾行,好忙,不幫嗎??
#include<fstream>
#include<algorithm>
#include<iterator>
using namespace std;
int main(){
ifstream fin( "infile" );
ofstream fout( "outfile" );
istreambuf_iterator<char> ibuf_iter( fin );
copy( ibuf_iter, istreambuf_iterator<char>(), ostreambuf_iterator<char>( fout ) );
return 0;
}
記得跟助教解釋喔,糾咪^.<
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 182.235.46.73
→
12/17 08:06, , 1F
12/17 08:06, 1F
→
12/17 09:12, , 2F
12/17 09:12, 2F
→
12/17 09:13, , 3F
12/17 09:13, 3F
→
12/17 10:25, , 4F
12/17 10:25, 4F
→
12/17 10:26, , 5F
12/17 10:26, 5F
→
12/17 16:41, , 6F
12/17 16:41, 6F
→
12/17 18:40, , 7F
12/17 18:40, 7F
→
12/17 18:42, , 8F
12/17 18:42, 8F
→
12/17 18:42, , 9F
12/17 18:42, 9F
→
12/17 19:40, , 10F
12/17 19:40, 10F
→
12/17 21:00, , 11F
12/17 21:00, 11F
→
12/17 21:38, , 12F
12/17 21:38, 12F
→
12/17 21:39, , 13F
12/17 21:39, 13F
→
12/18 00:21, , 14F
12/18 00:21, 14F
→
12/18 00:24, , 15F
12/18 00:24, 15F
→
12/18 00:33, , 16F
12/18 00:33, 16F
→
12/18 08:19, , 17F
12/18 08:19, 17F
→
12/20 08:55, , 18F
12/20 08:55, 18F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章