From: G DOT DegliEsposti AT ads DOT it To: "Henri Ossi" cc: djgpp AT delorie DOT com Message-ID: Date: Tue, 21 Apr 1998 16:54:34 +0200 Subject: Re: Separating two 8bit numbers from 16bit Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk > Now I'm trying to store a 16bit number as two ASCII characters to my file. > So, I was wondering, if there's a fast way to separate a 16bit number to two > 8bit numbers? > > I know, that I can do this easily with inline asm (and I also can do it), > but is there a fast and short way to do this in C? this would rather belong to comp.lang.c, but anyway: short n; unsigned char ch, cl; ch = n >> 8; cl = n & 0xff; ciao Giacomo