Trouble using SPAWN function 
Author Message
 Trouble using SPAWN function

I am trying to spawn a process using Turbo C 2.0 where
the executable I am spawning requires the pipe character <
to define an input file.  In other words, on the command
line I would execute the program as follows:

progname < inputfil.txt

Within my program, I have tried to call the progname.exe
executable by using the spawnle function as follows:


With the spawn function shown above, the progname program
complains that "<" and "inputfil.txt" are invalid arguments
yet when I run progname from the command line it works fine.
Other arguments that don't use the "<" character work fine
with the spawnle function.  Any clues as to how to do this?
I'm assuming that since the "<" character is really a DOS function,
spawn doesn't know how to handle it.  I would also assume that
the same problem would be had with the "| more" addition to
some commands.

Thanks for any help,

Dave Kingma                  450 Canterbury St.
Sr. Research Engineer        Christiansburg, VA 24073
Fiber Optic Products
Litton Poly-Scientific
1213 N. Main St.

(703)-552-3011 x326          Amateur Radio: WA4RDI

Sat, 06 Dec 1997 03:00:00 GMT  
 Trouble using SPAWN function
: spawnle(P_WAIT,"progname","progname","<","inputfil.txt",NULL);

I've had a similiar problem using spawn with PKZIP and it's comment
argument "z<comment.txt". The only way I found to go around it was to use
the system() function instead along with an sprintf() to include the whole
command line in a string. If you don't need to examine the returned DOS
errorcode, I don't see why it shouldn't work.

| Yojimbo  -TDU-                | Fast As The Wind,               |
| SysOp -                       | Quiet As The Forest,            |
| The Dojo BBS                  | Aggressive As Fire,             |
| +1.7i3.436.1795               | And                             |
| QUaRaNTiNE HomeSite           | Immovable as a Mountain         |

Sat, 06 Dec 1997 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Trouble using SPAWN function

2. Trouble using SPAWN funct

3. Using spawn functions in Borland

4. Troubles using C's scanf Function

5. Using spawn command

6. spawn() functions in Metrowerks CodeWarrior C

7. Spawn function parameters

8. where in Unix is the spawn function??

9. Redirecting STDOUT using spawn

10. Borland c....Spawn() function

11. Novice - Using spawn

12. BUG? in exec()/spawn() function family


Powered by phpBB® Forum Software