From: ryot AT bigfoot DOT com (George Ryot) Newsgroups: comp.os.msdos.djgpp Subject: Re: From Bytes to Int and Char Message-ID: <37bd890c.14677884@news.clara.net> References: <37B466D7 DOT 958F09E5 AT americasm01 DOT nt DOT com> <37B4DFD1 DOT 4D66 AT surfsouth DOT com> <37B57EB0 DOT 492A93AE AT unb DOT ca> <37ba82f5 DOT 7514501 AT news DOT clara DOT net> <37B82AAA DOT E7223AB1 AT americasm01 DOT nt DOT com> X-Newsreader: Forte Agent 1.5/32.452 X-No-Archive: yes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 20 Date: Mon, 16 Aug 1999 22:19:23 GMT NNTP-Posting-Host: 195.8.92.47 X-Complaints-To: abuse AT clara DOT net X-Trace: nnrp4.clara.net 934841963 195.8.92.47 (Mon, 16 Aug 1999 23:19:23 BST) NNTP-Posting-Date: Mon, 16 Aug 1999 23:19:23 BST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Campbell, Rolf [SKY:1U32:EXCH]" wrote: > I don't understand how your code is any less of a 'hack' than mine. Both are not > endian safe. Both will work consistantly on each individual machine (I'm not saying > that you could exchange data files and have them work). How is my code 'unsafe'? Casting between pointers to different types is nearly always unsafe. The code I posted will solve the original problem (as I understand it) and will work the same on *all* implementations except attention is required to unsigned values. The original post has now been answered and this has little to do with DJGPP. Nick, if you still have problems feel free to email me. Better still, try a more appropriate forum such as alt.comp.lang.learn.c-c++ or comp.lang.c where many C/C++ gurus are waiting to help you. -- george