From: Paul Campisi Date: Tue, 6 May 1997 14:57:01 -0400 (EDT) Message-Id: <199705061857.OAA20453@banana.ece.uc.edu> To: djgpp AT delorie DOT com Subject: Re: DIR/System question - speed Cc: fighteer AT cs DOT com Precedence: bulk > Please specify what version of DJGPP you are using. In v1.x, using > system involved swapping out the entire program to disk before running > the command; obviously this was an extremely slow task. In v2.x, the > speed of system() was vastly improved, and in v2.01, system() attempts > to emulate as much of the process of calling other programs as > possible. So a 2 second delay is way too much for a v2.01 program, > unless there is something else wrong. Please post the code fragment you > use and someone here will try to test it for you. I am using DJGPP Version 2.01, and a code fragment would be as as follows: system(mycommand); whereis "mycommand" is a char * which has the users command that they want to do. (For example "mycommand"="dir /w") As I said, it works, just slow. About a 2 sec delay before I see the dir on the screen. > Well, there's always the popen() command, which allows you to spawn an > external program and redirect its standard input or standard output to a > file. To capture the output of 'dir', you'd do something like this: > > > > Strangely, I just tested this and it froze when the pipe command was > invoked. Maybe this is a bug? Hmmm.. Good idea! I cannot test it now, but when I get home tonight I will test and see if opening the pipe causes a freeze on my machine as well. Thanks! Paul