Mail Archives: djgpp/1998/03/22/02:32:27
>
>I have this function to create a double buffer, but it always returns 0, yet
>I
>can still write to and copy the double buffer to the screen.
>
>unsigned char *double_buffer = NULL;
>unsigned int buffer_height = 200;
>unsigned int buffer_size = 320 * 200;
>
>int Create_Double_Buffer(int num_lines)
>{
>if ((double_buffer = (unsigned char *)malloc(320 * (num_lines + 1))) == NULL)
> return(0);
>
>/* Set the height of the buffer and compute its size */
>
>buffer_height = num_lines;
>buffer_size = 200 * num_lines/2;
>
>/* Fill the buffer with black (clear) */
>
>memset(double_buffer, 0, 200 * num_lines);
>
>/* Everything was ok */
>
>return (1);
>
>}
hmmm...
try :
if (!(double_buffer = malloc(320 * num_lines + 1)) )
Jim the loiterer
aloiterer AT juno DOT com
http://www.fortunecity.com/skyscraper/gigahertz/179/index.html
- Raw text -