From: "Richard Hasty" Newsgroups: comp.os.msdos.djgpp Subject: Help: read/write from printer port Date: 9 Jan 1998 05:44:19 GMT Organization: Illuminati Online Lines: 50 Message-ID: <01bd1cc1$d4914d00$ab51e0ce@rhasty> NNTP-Posting-Host: as4-dialup-33.wc-aus.io.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I'm brand new to DJGPP and I'm trying to write stuff to the printer port. I'm running Win95 if that has anything to do with it. I was thinking I'd be able to just use "open" and pretend I was writing to a file called LPT1 or PRN. It does not work as I would have expected though. The code (only a few lines) is at the end of the message. It bombs on the write operation. Is there a better way of doing it? I was thinking of trying to just write to the correct memory address. I have an old copy of Turbo C v 1.01 and I tried poke(0x000,0x0378,1); but that didn't work either. If I tried that under plain old dos would it work? Do I even have the right address for the parallel port? Can I do something equivalent using DJGPP? I would love to stop asking these questions. Are there any documents, books or any other resources for learning about how to do this kind of thing? Also, any reccomendations for the beginner in assembly and writing TSR programs and using interrupts? Many thanks for any assistance, Richard Hasty rhasty AT io DOT com #include #include #include #include #include int main(void) { int handle; int value=1; if ((handle = open("PRN", O_WRONLY, 0)) < 0 ) { perror("Error: Cannot open lpt1"); return 1; } if(write(handle, &value, 1) != 1) { printf("write_error"); return 1; } close(handle); return 0; }