[comp.sys.atari.st] help with io redirection, please!

Ritzert@DMZRZU71.BITNET (02/22/90)

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