Mail Archives: djgpp/1997/04/04/11:46:04
Jono Greene wrote:
>
> I am trying to write a simple program that will turn on a designated
> pin of the parallel port, at a designated time. I have found the
> following code, but I can't get it to compile under DJGPP:
>
> #include <stdio.h>
> #include <conio.h>
> #include <time.h>
>
> void main(void)
ok, let me be a smart ass for a second: according to the ansi standard,
main has to return an int. no matter what you see in some well known
books, you should use either
int main(void), or
int main(int argc, char **argv)
depending on whether you need command line arguments.
> if(t.ti_hour==10 && t.ti_min==05) _outp8(port,1);
> else _outp8(port,0);
your problem is with _outp8 ... you need the corresponding function from
the djgpp c library which is, outportb (b stands for byte) anyway, here
is the info form dj's on-line c library reference:
-----------
outportb
#include <pc.h>
void outportb(unsigned short _port, unsigned char _data);
Description: Write a single byte to an 8-bit port.
This function is provided as an inline assembler macro, and will be
optimized down to a single opcode when you optimize your program.
---------
by the way, this type of information is extremely easy to find. you
could either go through the info docs on your hard disk, or dj's online
reference and search for a function name resembling _outp8.
-- Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
*******************************************************************
- Raw text -