avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] file hex form converter reference


From: Ben Mann
Subject: RE: [avr-gcc-list] file hex form converter reference
Date: Mon, 29 Nov 2004 12:48:20 +0800

I'm not an expert on the c++ library, but perhaps also try

ofstream OpenOutputFile(OutputFile,ifstream::binary);

Ben Mann



-----Original Message-----
From: address@hidden [mailto:address@hidden
On Behalf Of Leo Hendrawan
Sent: Monday, 29 November 2004 7:20 PM
To: address@hidden
Subject: [avr-gcc-list] file hex form converter reference


Hello,

i/m looking for a C/C++ reference/source which could convert any file type
(esp. imag files) to hex form that could be included inside a C source for
AVR-gcc application.

for example:

instead of writing this in my source code:
const char ProgMemString PROGMEM = {"abc"};

i want it to be in this kind of hex form:
const char ProgMemString PROGMEM = {0x61 0x62 0x63 0x00};

i want to use for storing image file inside my embedded web server app.

i have made a source in C++ using ftream.h, which only read the source file
byte per byte using ifstream.get() func and store it into a temporary
buffer, then unsing sprinft("%c", buff[i]) to convert it in desired hex
form. and off course adding the NULL terminator at the end of the output
file. it does work for my html source files, but not for the image files. i
think because of the .eof() func i used.

the following attached file shows my program in C++.

Thank you very much for any advice.

Best regards,

--------------------------
 Leo Hendrawan
 13200005
 at 11:07 Nov 29
--------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]