[請不要評論使用Turbo C++。我知道它已經過時,但我們只是這樣教。] 有點類似的錯誤在這裏Why do I get a 'ÿ' char after every include that is extracted by my parser? - C但我不能將它與我的代碼 - 嗯,我是一個新手。文件處理,複製內容時插入ÿ字符
#include<fstream.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
ifstream read_file;
read_file.open("Employee.txt");
ofstream write_file;
write_file.open("Another.txt");
while(!read_file.eof())
{
/*Also when I use, write<<read_file.get(ch) in this block instead of the two statements below, it writes some kind of address in the file. Please tell me about that too why it happens. */
read_file.get(ch);
write_file<<ch;
}
read_file.close();
write_file.close();
getch();
}
我面臨的問題是,它在「另一個」文件的末尾附加ÿ字符。
如:1個 名稱:ABC 則文本將其複製到 「另一個」 是: ID:1個 名稱:abcÿ
運行,不走,從這個類。 –
[必須閱讀](http://stackoverflow.com/q/5605125/1870232) – P0W