Click to See Complete Forum and Search --> : I need to send things to my printer, how do I do it in LInux??
Concrete Geist
09-16-2001, 11:12 AM
Yeah, my printer isn't working, and I don't know what's wrong, so I figure, send it info to print, and use perror when it doesn't print. It's a long shot, but it might work, at least I think so. BTW, I'll be using C.
Concrete Geist
09-16-2001, 11:21 AM
And btw, I just need the data stream (stdprn doesn't work in Linux). And I'll be using fprintf.
debiandude
09-16-2001, 11:29 AM
Remember everything in linux is a file. Just fopen /dev/lp0. Here look at this:
#include <stdio.h>
int main(void) {
FILE *fp;
char *str = "This is a test";
if((fp = fopen("/dev/lp0", "w")) == NULL) {
perror("ERROR ");
exit(1);
}
fprintf(fp, "%s\f", str);
if(ferror(fp)) {
perror("ERROR");
exit(1);
}
fclose(fp);
return;
}
[ 16 September 2001: Message edited by: debiandude ]
Concrete Geist
09-16-2001, 11:41 AM
thanks. :)
Now, it says ERROR : Device or Resource busy
What do you think could be causing this, and how could I fix it?
I know that when I open it up to look at the ink, it's supposed to make some noise and the ink cartridge moves around (it's a Cannon). But nothing's happening, it doesn't print, and I can't get to it through printerdrake either. :confused: