Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!hubcap!ncrcae!secola!gharris From: gharris@secola.Columbia.NCR.COM (Buddy Harris) Newsgroups: comp.lang.c Subject: Re: printf() problem Keywords: C printf Message-ID: <353@secola.Columbia.NCR.COM> Date: 26 Apr 89 18:56:26 GMT References: <11657@hodge.UUCP> Reply-To: gharris@secola.Columbia.NCR.COM (Buddy Harris) Organization: NCR SE-Columbia, West Columbia, SC Lines: 21 In article <11657@hodge.UUCP> jdm@hodge.UUCP (jdm) writes: -> I fopen() the file in binary mode and used the following line -> of code to read and print out the data: -> printf("%x %x %x %x\n", getc(fp), getc(fp), getc(fp), getc(fp)); -> Although the order of the data in the file is: -> 92 AB 4E 33 -> printf() displays it as: -> 33 4E AB 92 This is something that I don't understand either, but apparently printf() evluates from right to left. Be careful with stetements like this: printf("%d %d %d %d", i++, i++, i++, i++); This evluates from right to left also. -- ------------------------------------------------------------------------------ ! Sleep well and dream of large women. - The Dread Pirate Roberds ! ! gharris@secola.Columbia.NCR.COM (George Harris) Have a nice day :-) ! ------------------------------------------------------------------------------