Re: [Dev-C++] A bit stumped on binary files
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-05-22 21:26:43
|
Just do: int i = 10; (char*)i; and write out sizeof(i) bytes. /Per W On Sat, 22 May 2004, Ewald Horn wrote: > >In fopen you can specify a binary stream with the b modifier in the > >wanted open type (glibc reference). > > > I do open the file as binary, using an IO stream. That's not the problem. I > need to know how to convert an integer value into it's 4 byte equivalent. > For instance 39184 is $00009910 and I would like to write [00,00,99,10] as > hex values to my file. I was just wondering if there was a way to dump an > entire struct to a file and then read it back later. > > > Regards > Ewald Horn > Proprietor/Eienaar : Horn Labs > Cell/Sel : 083 519 1615 > Website : http://www.hornlabs.co.za > Email/E-pos : in...@ho... > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |