好了,所以,我現在可以從.txt文件作爲變量讀,但我怎麼寫整數一次變回我的文本文件? 例子:寫一個整數到ifstream的C++
xps.open ("xp.txt"); //Text file is loaded and applied to ifstream 'xps'
int xp;
xps >> xp; //xps is applied to integer xp
xp += 50; //xp has 50 added to it's value
,然後我要寫入的xp值(覆蓋以前的數量)爲xp.txt,所以我會怎麼做呢?
應該是XPS << XP – Dikei 2011-05-02 02:52:54
woops,伴你左右。固定。 – 2011-05-02 16:41:49