Mail Archives: djgpp/2003/06/15/09:46:37
johnerzhou AT yahoo DOT com wrote->
> Hi,
> I want to use parallel port(print port) on PC, want to
> write/read byte to/from it. I have installed DJGPP,
> which library or function should use to open the ort
> and read/write byte via it. Where can I get it?
> Thanks a lot.
> Best regards,
> Tony ZHOU
if you need direct hardware access because it's a special kind of hardware that
you want to access, you can use inportxx() or outportxx() from libpc or
use assembler or whatever.
some simple things can more easily be done with the usual file-i/o
functions. to access port n you only gotta open the file LPTn.
------------
#include <fcntl.h>
int main(void)
{
FILE *port;
port=fopen("LPT1","rb");
fputs("hello world",port);
/*
i don't know wheter you can read back something with these functions,
but you can try...*/
fclose(port);
}
-----------------
you could also code your own DOS device driver which could be accessed in
a similar way. links:
http://www.nondot.org/sabre/os/files/Executables/SYS.txt
http://www.bsdg.org/swag/DOS/0091.PAS.html
http://www.clipx.net/ng/dos5/ng2ca0f.php
- Raw text -