PDA

Visualizza la versione completa : [c++]hard coding dati binari


giuseppe500
11-04-2012, 14:44
ciao.
Come posso creare un header(.h) tipo questo



const unsigned char raw_data[] = {
0x21, 0x20, 0xc2, 0xa6, 0xc3, 0xb4, 0xc2, 0xbf,
0xc3, 0x82, 0xc3, 0x8b, 0xc2, 0xa4, 0x20, 0xc3,
0x8d, 0xc3, 0x8c, 0x4c, 0x3f, 0x20, 0x20, 0xc3,
0x80, 0xc3, 0xbf, 0x20, 0x20, 0xc3, 0x80, 0xc3,
0xbf, 0xc2, 0xa5, 0x20, 0xc5, 0xa1, 0xe2, 0x84,
0xa2, 0xc2, 0xa9, 0x40, 0x20, 0x20, 0xc3, 0x80,
0xc3, 0xbf, 0x20, 0x20, 0xc3, 0x80, 0xc3, 0xbf,
0x60, 0x20, 0x6f, 0x72, 0x20, 0x60, 0x21, 0x20,
0x48, 0xc2, 0xb7, 0xc3, 0xb4, 0xc2, 0xbf, 0xc3,
0x82, 0xc3, 0x8b, 0xc2, 0xa4, 0x20, 0xc3, 0x8d,
0xc3, 0x8c, 0x4c, 0x3f, 0x20, 0x20, 0xc3, 0x80,
0xc3, 0xbf, 0x33, 0x33, 0x33, 0x3f, 0xc2, 0xa5,
0x20, 0xc5, 0xa1, 0xe2, 0x84, 0xa2, 0xc2, 0xa9,
0x40, 0x20, 0x20, 0xc3, 0x80, 0xc3, 0xbf, 0x66,
0x66, 0xc2, 0xa6, 0x40, 0x0a,
};


a partire da un file binario?
grazie.

oregon
11-04-2012, 15:27
Apri il file binario in input e il file di testo in output ... leggi da uno e scrivi sull'altro con opportune printf ...

Loading