From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: ios::binary ignored by GCC - HELP! Date: Sat, 07 Nov 1998 12:29:38 -0500 Content-Transfer-Encoding: 7bit References: <7208uh$epn$1 AT news DOT luth DOT se> Organization: Nocturnal Aviation X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Lines: 29 NNTP-Posting-Host: 1cust116.tnt12.nyc3.da.uu.net X-ELN-Date: Sat Nov 7 09:45:20 1998 X-Mailer: Mozilla 4.5 [en] (Win95; I) Message-ID: <36448382.68F2FAFF@earthlink.net> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com sl wrote: > > On 7 Nov 1998 01:49:05 GMT, Martin Str|mberg wrote: > > >: does one go about fixing this? > > > >Try "fprintf(f, "%c", 7);" or the equivalent in C++ (I don't know > >C++). > > But then what happens when/if I try to write "int" to the file? All > it really requires is two bytes, but GCC writes it out as its text > counterpart for some reason.. Gill, it is not just gcc. All C and C++ compilers treat requesrs for formatted ouput (*printf()) as requests for formatted output. If you have an object of type T that you want to write to a stream s: #include T object; FILE *s; /* ... */ fwrite(&object, sizeof object, 1, s); /* or */ fwrite(&object, sizeof(T), 1, s); -- Martin Ambuhl (mambuhl AT earthlink DOT net) Note: mambuhl AT tiac DOT net will soon be inactive