Results 1 to 3 of 3
is there a *nix equivalent to M$'s stdprn stream? if so, which header file is it in? i need to know for an exercise. i'm trying to do.. it says ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-23-2004 #1Linux Engineer
- Join Date
- Sep 2003
- Location
- Knoxhell, TN
- Posts
- 1,078
stdprn equivalent
is there a *nix equivalent to M$'s stdprn stream? if so, which header file is it in? i need to know for an exercise. i'm trying to do.. it says to redirect a file to the printer one character at a time..
- 01-24-2004 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
If I were to do this, I would do it like this:
And then use the prn filehandle to print data. That's the correct way to print stuff in UNIX. If that exercise absolutely forces you to print in any other way, it's inherently stupid. If you necessarily must send data directly to the printer (note: you shouldn't do that), open /dev/lp0 (which is the parallel port) and print data to that.Code:FILE *prn; prn = popen("lpr");
I don't really understand the one character at a time thing. Why would you want to send one character at a time to the filehandle? It's not like the parallel port can actually transmit more than one byte at a time anyway, so it's better to let the kernel buffer the data and use DMA transfers.
- 01-24-2004 #3Linux Engineer
- Join Date
- Sep 2003
- Location
- Knoxhell, TN
- Posts
- 1,078
theexercise was supposed to show how to use standard streams.. but instead of just listing *standard* stuff, the authors decided that a reference to an OS specific stream was necessary.. don't ask me.. i thought it was stupid, too.. in fact, because the next few exercises wanted you to print the same way, i skipped them.


Reply With Quote
