* Re: Stdprn in GCC
@ 2002-10-22 16:13 David
2002-10-23 13:35 ` John Carter
0 siblings, 1 reply; 5+ messages in thread
From: David @ 2002-10-22 16:13 UTC (permalink / raw)
To: gcc-help; +Cc: John Carter
John Carter wrote:
>If you want it to come out (directly) /dev/lp0 (the line printer port)
>just open that and fire away.
>
>Either that stuff it in a file and invoke "lpr fileName" at a later stage.
>
>You can also pipe either stdout to "lpr" or fork and pipe to lpr.
>
>A good reference source if the Linux Documentation Project (ask google)
>and in particular the Linux Programmers Guide.
>
>
>
>
I searched google and haven't came up with anything yet, tried putting /dev/lp0
in there and piping it to lpr. Just get errors about it.
> page = 0; line = 1; do_heading( argc[1] ); while( fgets(
> buffer, 256, fp ) != NULL ) { if( line % 55 == 0 )
> do_heading( argc[1] ); fprintf( stdprn, "%4d:\t%s",
> line++, buffer ); } fprintf( stdprn, "\f" ); fclose(fp);
> return 0; } /* Start function */ void do_heading( char *filename )
> { page++; if( page > 1) fprintf( stdprn, "\f");
> fprintf( stdprn, "Page: %d, %s\n\n", page, filename ); }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stdprn in GCC
2002-10-22 16:13 Stdprn in GCC David
@ 2002-10-23 13:35 ` John Carter
0 siblings, 0 replies; 5+ messages in thread
From: John Carter @ 2002-10-23 13:35 UTC (permalink / raw)
To: David; +Cc: gcc-help, John Carter
On Tue, 22 Oct 2002, David wrote:
Hint 1: Clip out a small piece of code you having a problem with and send
it and the error message you are having difficulty with to the group.
Makes it a lot easy to give a good answer.
You could do things like...
FILE * stdprn;
main() {
stdprn = fopen( "/dev/lp0", "w");
And it will head for the line printeer port on your machine.
If you want it spooled or sent to a remote printer you have to be more
sophisticated.
You may have to chmod o+rwx /dev/lp0 for the above simplistic trick to
work.
--
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand
Good Ideas:
Ruby - http://www.ruby-lang-org - The best of perl,python,scheme without the pain.
Valgrind - http://developer.kde.org/~sewardj/ - memory debugger for x86-GNU/Linux
Free your books - http://www.bookcrossing.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stdprn in GCC
2002-10-22 14:41 David
2002-10-22 15:06 ` John Carter
@ 2002-10-22 15:08 ` bjorn rohde jensen
1 sibling, 0 replies; 5+ messages in thread
From: bjorn rohde jensen @ 2002-10-22 15:08 UTC (permalink / raw)
To: David; +Cc: gcc-help
Hi David,
In Ansi C you would probably mostly use the
printf family of functions to perform output
and the scanf family to perform input.
Yours sincererly,
Bjorn
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stdprn in GCC
2002-10-22 14:41 David
@ 2002-10-22 15:06 ` John Carter
2002-10-22 15:08 ` bjorn rohde jensen
1 sibling, 0 replies; 5+ messages in thread
From: John Carter @ 2002-10-22 15:06 UTC (permalink / raw)
To: David; +Cc: gcc-help
On Tue, 22 Oct 2002, David wrote:
> Starting to learn C Programming all over again in Linux this time.
>
> The problem is that most books are for Windows/Dos also.
>
> 'stdprn' is not contained in stdio.h in GCC.
If you want it to come out (directly) /dev/lp0 (the line printer port)
just open that and fire away.
Either that stuff it in a file and invoke "lpr fileName" at a later stage.
You can also pipe either stdout to "lpr" or fork and pipe to lpr.
A good reference source if the Linux Documentation Project (ask google)
and in particular the Linux Programmers Guide.
--
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand
Good Ideas:
Ruby - http://www.ruby-lang-org - The best of perl,python,scheme without the pain.
Valgrind - http://developer.kde.org/~sewardj/ - memory debugger for x86-GNU/Linux
Free your books - http://www.bookcrossing.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Stdprn in GCC
@ 2002-10-22 14:41 David
2002-10-22 15:06 ` John Carter
2002-10-22 15:08 ` bjorn rohde jensen
0 siblings, 2 replies; 5+ messages in thread
From: David @ 2002-10-22 14:41 UTC (permalink / raw)
To: gcc-help
Hello,
Starting to learn C Programming all over again in Linux this time.
The problem is that most books are for Windows/Dos also.
'stdprn' is not contained in stdio.h in GCC.
Is it in another library, is there an equivilant library function to use?
If not, how do you send a file to the printer with GCC?
This is stumping me and found no help on Google.
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-10-23 20:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-22 16:13 Stdprn in GCC David
2002-10-23 13:35 ` John Carter
-- strict thread matches above, loose matches on Subject: below --
2002-10-22 14:41 David
2002-10-22 15:06 ` John Carter
2002-10-22 15:08 ` bjorn rohde jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).