Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!tandem!zorch!amiga0!mykes From: mykes@amiga0.SF-Bay.ORG (Mike Schwartz) Newsgroups: comp.sys.amiga.programmer Subject: Re: 4 bytes to a long? Message-ID: Date: 11 Jun 91 04:09:36 GMT References: <55908@nigel.ee.udel.edu> Organization: Amiga makes it possible Lines: 24 In article <55908@nigel.ee.udel.edu> jleonard@pica.army.mil writes: >mrimages@beach.gal.utexas.edu in <451.28517f01@beach.gal.utexas.edu> write: > > Is there a fast, simple way to convert 4 bytes into a long? > >I use : > >char ch[4]; >long l; > >memcpy( (char *)&l, ch, sizeof(long)); If portability isn't a concern: ULONG l; char *ch = &l; ch[0] is MSB of l, ch[3] is LSB. This is dependant on byte order of ULONG. -- **************************************************** * I want games that look like Shadow of the Beast * * but play like Leisure Suit Larry. * ****************************************************