From: tom burgess Newsgroups: comp.os.msdos.djgpp Subject: Re: I have a question for Allegro. I really hope someonce can answer it!!!! Date: Sun, 01 Mar 1998 02:44:44 -0800 Organization: BCTEL Advanced Communications Lines: 27 Message-ID: <34F93C1C.2FA7@drao.nrc.ca> References: <34f8ea8c DOT 0 AT news1 DOT ibm DOT net> NNTP-Posting-Host: pntn02m03-209.bctel.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Oren Marciano wrote: > > What does this code actually do: > > xgrid = MID(1, atoi(griddle_xgrid), 0xFFFF); > > xgrid is an int > griddle_xgrid is a char > > what is MID, what is atoi, why is the last parimater 0xFFFF > > This is taken from the Allegro Grabber code. > > If anyone can answer this I would appreciate it. MID is defined in allegro.h and is being used to clip the grid value to within the range 1 - 65535 (0xFFFF). atoi is a standard C function (Ascii TO Integer) which converts a string to int. You will find allegro.h in DJGPP\INCLUDE. Here's the Allegro def. #ifndef MIN #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) #define MID(x,y,z) MAX((x), MIN((y), (z))) #endif regards, tom