CompuServe Thread

#Help!!!

8 messages in this thread
#34256From: randy auschratApr 16, 1993 9:57 PM
Hopefully somebody out there can give me a hand. I'm currently working on a lab that deals with outputting data to the printer. At school I use IBM's and therefor have some trouble converting some of the code so it's works on my amiga. Printing is one of them. When I do a fprintf(stdprn, "hello");, the compiler gives me something about an unidentified identifier at stdprn. I've tried to find the amiga equivalent of stdprn but I just can't find it. Can anybody help me? Randy.
#34283From: Brian BartlettApr 18, 1993 12:32 AM
Randy, I just went through all my ANSI "C" stuff here and I can't find stdprn anywhere. It's not in the specification, so it's no suprise that it's not in the compiler. I would hazard a guess that stdprn is something provided by your IBM compiler only (yup! just found it in Turbo "C"). So, you will have to roll your own here, using the built-in system functions. I'll leave that to someone more experienced, since the printer is not one of the things I've had to play with here. Brian
#34302From: randy auschratApr 18, 1993 1:23 PM
Thanks. I thought it might be something like that. Randy.
#34290From: verjusApr 18, 1993 8:09 AM
Hi, stdprn is not a standard name for the Lattice compiler, easiest thing you can do is to change the stdprn into stdout. Than when executing the program redirect the output to your printer, for example: fprintf( stdout, "Hello world\n" ); program >PRT:
#34295From: Doug WalkerApr 18, 1993 11:16 AM
Another way of getting stdprn: #include <stdio.h> FILE *stdprn; void init_stdprn(void) { stdprn = fopen("PRT:", "w"); } Just put the above in your program somewhere, then call init_stdprn from your main() routine (or anywhere else BEFORE you use stdprn, but AFTER stdio is initialized.) You could modify the source code to _main as provided in SC:SOURCE/_main.c to initialize stdprn as well. Then you'll need to declare stdprn in each module that uses it: extern FILE *stdprn; and everything should work OK. –Doug
#34303From: randy auschratApr 18, 1993 1:25 PM
Hmmmm, on the compiler I was using at school stdout directs the output to the monitor. I'll have to try it on the amiga. Thanks… Randy.
#34298From: SyndesisApr 18, 1993 12:05 PM
Others have suggested a good answer to your question, but to give a little history… CP/M and MS-DOS have always had this "stdprn" device, like "stdin" and "stdout". the Amiga doesn't. Just tack that code suggested in message 34295 into your program and it will work fine. Or, consider some other method of directing that output – some users might want it to go to a file instead of the printer.
#34304From: randy auschratApr 18, 1993 1:28 PM
Ok, once again thanks for the info. Actually I am writing stuff to a file but printing is one of the many functions that our teach wants included in the program. Actually pretty cool. I now have the know how to make my character generation program. Anyways, talk later… Randy.