Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: I have a question for Allegro. I really hope someonce can ans wer it!!!! Date: Mon, 2 Mar 1998 09:32:48 -0000 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk Oren Marciano writes: > What does this code actually do: > > xgrid = MID(1, atoi(griddle_xgrid), 0xFFFF); > > xgrid is an int > griddle_xgrid is a char Not quite. Actually griddle_xgrid is an array of chars, ie. a string. > what is MID, what is atoi, why is the last parimater 0xFFFF > > This is taken from the Allegro Grabber code. atoi() is a standard C library function: see "info libc al atoi". It converts an ASCII string into an integer, and in this case is being used to read whatever value the user typed into the grid size edit box. MID is a macro, defined in allegro.h, which clamps a value to a particular range. In this case it is being used to make sure the grid size will be something between 1 and 0xFFFF, to prevent any silly values getting through and upsetting the grab function. There is no particular reason for using 0xFFFF as the upper limit, other than that it is suitably large and a nice round number. Shawn Hargreaves.