Mail Archives: djgpp/1997/05/09/22:16:49
From: | Ross Litscher <Litscher DOT 1 AT osu DOT edu>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | compile warning
|
Date: | Fri, 09 May 1997 19:00:38 -0400
|
Organization: | The Ohio State University
|
Message-ID: | <3373AC95.2D64@osu.edu>
|
Reply-To: | Litscher DOT 1 AT osu DOT edu
|
NNTP-Posting-Host: | s-100-225.resnet.ohio-state.edu
|
Mime-Version: | 1.0
|
Lines: | 59
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi, I am kind of new to c++ and brand new to djgpp. I got about 98% of
the following code off the internet. The problem is that I get a warning
after I compile this. It is as follows:
vidmode2.cpp(30) Warning: implicit declaration of function 'int
rand(...)'
The program still runs correctly and all, though. By the way, there is a
point in the program where I wanted the drawing to screen to slow down a
bit so I used a 'while' loop where a number increases by 1 until it
reaches a certain number. Could someone look at this and tell me if
there is a better way to do this? Or is this fine. Any other comments
would be greatly appreciated, I'm completely new at graphics
programming, too. Thanks. The source follows.
#include <dos.h>
#include <sys/farptr.h>
#include <go32.h>
#include <conio.h>
#define GRAPHICS 0x013
#define TEXT 0x03
long video_buffer = 0xa0000;
void put_pixel(short int x, short int y, char color)
{
_farpokeb(_dos_ds, video_buffer + (y << 8) + (y << 6) + x, color);
}
void set_video_mode(int mode)
{
union REGS regs; //what does this do? (union?)
regs.x.ax = mode;
int86(0x10, ®s, ®s);
}
void main(void)
{
unsigned count;
set_video_mode(GRAPHICS);
for(count = 0; count < 32000; count++)
{
put_pixel(rand() % 320, rand() % 200, rand() %256);
int wait=0;
while(wait < 5000) //just to slow down
{ //the writting to
wait++; //video memory
}
}
getch();
set_video_mode(TEXT);
}
Thanks,
Ross
- Raw text -