close

CR+LF ('\r\n', 0x0D 0x0A)

 

如果只要輸出 Line Feed(0x0A)

out << ‘0x0A’;

或是

out << ‘\n’;

想像中應該沒問題, 但是事情總是不盡如人意

萬一你寫檔案的編碼是ASCII

則你會發現 0x0D也自動補上去@@

   1: ofstream out( Filename.c_str() )

image

反之, 寫檔案改用binary模式去則不會發生這種狀況><

   1: ofstream out( Filename.c_str(), ios::binary)

image

 

參考文章:

  1. Carriage return wiki
arrow
arrow
    全站熱搜

    me1237guy 發表在 痞客邦 留言(0) 人氣()