#include "stdafx.h"
using namespace std;
int main() {
ofstream out("out.dat");
char ss[19] = { 0x78, 0x9c , 0xe3 , 0x62 , 0x60 , 0xe0
, 0x62 , 0x60 , 0xf5 , 0x49 , 0x2d , 0x4b , 0xcd
, 0x61 , 0x66, 0x60 , 0xa9 , 0x0a , 0xc8 };
out.seekp(0);
out.write(ss, 19);
return 0;
}
輸出: 20個(gè)字節(jié)
789c e362 60e0 6260 f549 2d4b cd61 6660
a90d 0ac8
||________多了一個(gè)0x0d
VS2017, Win10SDK, système Win7 x64
Version x86 (Win32)
S'il vous pla?t dites-moi, que se passe-t-il ? Est-ce un cas ou un BUG ?
補(bǔ)充: 好像當(dāng)輸出的字節(jié)數(shù)大于等于19時(shí),就會(huì)在中間多輸出一個(gè)0x0d,而小于19個(gè)字節(jié)的輸出就不會(huì)出問題
歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~
Veuillez utiliser ios::binary
pour lire et écrire des fichiers binaires.
ofstream out("out.dat", ios::binary);