Thread View: alt.msdos.programmer
3 messages
3 total messages
Started by Elo Marko Juhani
Tue, 04 Aug 1992 09:18
printing through spawn
Author: Elo Marko Juhani
Date: Tue, 04 Aug 1992 09:18
Date: Tue, 04 Aug 1992 09:18
12 lines
835 bytes
835 bytes
I'm working with MSC 5.0 compiler and have tried to use the "print"- command through spawn-function. Even huge drawings work fine, but how can I prevent the message "... is currently being printed" from showing up? I've tried to give a parameter ">tmp", or ">" and "tmp" to spawn, but I get the message "parameter format incorrect". Please, answer via e-mail. me74955@cs.tut.fi --
Re: printing through spawn
Author: Keith Rice
Date: Tue, 04 Aug 1992 19:07
Date: Tue, 04 Aug 1992 19:07
24 lines
1815 bytes
1815 bytes
In <1992Aug4.091802.10778@funet.fi> me74955@cs.tut.fi (Elo Marko Juhani) writes: >I'm working with MSC 5.0 compiler and have tried to use the "print"- >command through spawn-function. Even huge drawings work fine, but how >can I prevent the message "... is currently being printed" from showing >up? I've tried to give a parameter ">tmp", or ">" and "tmp" to spawn, >but I get the message "parameter format incorrect". I tried the same thing and used "> nul" at the end of the print command and everything worked OK for me. -- *************************************************************************** * D. Keith Rice -- University of North Texas -- drice@ponder.csci.unt.edu * *************************************************************************** * "I like people. I like the concept of people. People ruin that." * * -- Damon Wayans on "Late Night with David Letterman" 7/23/92 * *************************************************************************** * Beta Test: To voluntarily entrust one's data, livelihood and sanity to * * hardware or software intended to destroy all three. In * * earlier days, virgins were selected to beta test volcanoes. * ***************************************************************************
Re: printing through spawn
Author: Alexander Pruss
Date: Tue, 04 Aug 1992 21:07
Date: Tue, 04 Aug 1992 21:07
45 lines
2260 bytes
2260 bytes
In article <drice.712955251@ponder> drice@ponder.csci.unt.edu (Keith Rice) writes:
>In <1992Aug4.091802.10778@funet.fi> me74955@cs.tut.fi (Elo Marko Juhani) writes:
>
>
>>I'm working with MSC 5.0 compiler and have tried to use the "print"-
>>command through spawn-function. Even huge drawings work fine, but how
>>can I prevent the message "... is currently being printed" from showing
>>up? I've tried to give a parameter ">tmp", or ">" and "tmp" to spawn,
>>but I get the message "parameter format incorrect".
>
>I tried the same thing and used "> nul" at the end of the print command
>and everything worked OK for me.
A little problem in both cases. You have to be sure that PRINT has been
invoked before your program is run. Otherwise, the SPAWNed PRINT will
attempt to go memory resident, and OOPS, we will be in trouble, since
the newly resident PRINT will lock your program forever in memory.
--
ANyway, your problem has two solutions. One is to use the system()
call, which is fine, but it loads COMMAND.COM and might do dangerous
things in low memory situations. The other is to dup some handles.
I think this works, but have not tested:
{
int h1,h2;
h1=open("NUL",O_WRITE);
h2=dup(fileno(stdout));
dup2(h1,fileno(stdout)); /* or h2,h1??? */
spawn(... /* no > NUL, just the normal spawn */ );
dup2(h2,fileno(stdout));
close(h1);
}
However, because of the abovementioned problems, I recommend that you
just copy the file to stdprn yourself (but no spooling then).
--
Alexander Pruss, Dept. of Mathematics, U. of British Columbia, Vancouver,Canada
pruss@math.ubc.ca
Where there is no love, put love, and you will draw out love.
- St. John of the Cross
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads