From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: How to convert binary files Date: 12 Mar 2001 16:30:06 GMT Organization: Aachen University of Technology (RWTH) Lines: 29 Message-ID: <98itie$3m0$1@nets3.rz.RWTH-Aachen.DE> References: <3AACFABA DOT 8929 DOT 391FC6 AT localhost> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: nets3.rz.RWTH-Aachen.DE 984414606 3776 137.226.32.75 (12 Mar 2001 16:30:06 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 12 Mar 2001 16:30:06 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Igor Bujna wrote: > Hi, [What on earth are all those Ctrl-O's doing there, at the end of each line???] > I have some programs under BCC version 4.5. And I have some binary > files, when i want to compile my programs under djgpp is everything > OK, but how can i convert my binary files from bcc to djgpp. You don't strictly have to convert the files at all. You just have to learn that you have to read them in a more careful way than by simply saying fread (&somestruct, sizeof(somestruct), file); Doing it that way is about as bad an idea as gets, speaking of portability of your program to other compilers, let alone other hardware platforms. Read your struct field by field, with fread() calls, be careful about how large 'int' and all the other types *really* are, on each of the participating compiler, and you can read the existing binary file in DJGPP and BCC. You can even use the same source code, if you do it right. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.