🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #41220

help with io redirection, please!

#41220
From: Ritzert
Date: Thu, 22 Feb 1990 00:58
57 lines
2333 bytes
hi,

I don't understand why redirecting the input of Cconrs() doesn't work.
Here is a simple example of what I'm trying to do (compilers: Laser C
1.2, GCC 1.34):

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* redirect stdin and pexec the program that shall do the real work       */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include  <osbind.h>
main()    {
          int fp;
          if( (fp = Fopen("d:\\egs\\system\\base\\ll.g",0)) < 0 ) {
                    Cconws("Fopen\n");
                    Pterm(fp);
          }
          if( (fp = Fforce(0,fp)) < 0 ) {
                    Cconws("Fforce\n");
                    Pterm(fp);
          }
          if( (fp = (int)Pexec(0,"testt.prg","","")) < 0 ) {
                    Cconws("Pexec\n");
                    Pterm(fp);
          }
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* testt --- silly demonstration program:                                 */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#include  <osbind.h>
main()
{
          char buf[123];
          buf[0] = 121;
          for(;;)   {
                    Cconws("? ");
                    Cconrs(&buf[0]);
                    Cconws("\r\n");Cconws(&buf[2]);Cconws(" !\r\n");
          }
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

If I remember correctly from the previous discussions of io-redirection,
this code should work (it does work when I try to redirect stdout). But
it doesn't. Instead, the demo program still waits for input from the
keyboard. What am I doing wrong, what is the correct way to redirect the
input to Cconws() ?

BTW, the Absoft librarian also uses Cconrs() to read its commands...

Thanks for any comments

Michael Ritzert
mjr@dmzrzu71.bitnet
Technical Details
Message-ID: <900222005804.790174@DMZRZU71-UNI-MAINZ--GERMANY>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!ulysses!ucbvax!DMZRZU71.BITNET!Ritzert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!ulysses!ucbvax!DMZRZU71.BITNET!Ritzert
From: Ritzert@DMZRZU71.BITNET
Newsgroups: comp.sys.atari.st
Subject: help with io redirection, please!
Message-ID: <900222005804.790174@DMZRZU71-UNI-MAINZ--GERMANY>
Date: 22 Feb 90 00:58:00 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 57