Problem in using gnu-win32(b18)

Larry Hall (RFK Partners Inc)
Thu Jan 8 08:20:00 GMT 1998

At 05:17 PM 1/8/98 +0900, Kim KiSun wrote:
>When I used system call like these,
>  I found problem that output files were not appeared immediately.
>int main()
>    :
>    :
> system("gcc -o test.o -I~~ -L~~  test.c");                       // call-1
> system("gcc -o test.exe -I~~  -L~~  test2.c test3.c  test.o");   // call-2
> execvp("test.exe", argv);                                        // call-3
>    :
>    :
>call-2 put error message,
>  because test.o file has not been yet existed at call-2 time.
>call-3 put error messages, too.
>  Because test.exe file has not been yet existed at call-3 time.
>These files(test.o & test.exe) were appeared in some times later.
>To my knowledge, system() function is started after previous process termination. But this situation tell different results!
>How  can I use system call function without this problem?
>How  can I force these output files to be written immediately?
>Let me see any clue!!
>Thank you!

Are you on 95 or NT?  I don't know if this is the same problem you see or
not but a while back I noticed that on 95 I would get a discrepancy between
the number of files I could find in a directory listing and those that should
be there if I had "recently" added more files to that directory.  Essentially,
my program called an external program via system() or the underlying
CreateProcess() call (which is what system() eventually calls anyway) and
that program moved files into the directory I was trying to subsequently
get a listing for.  I would find that the listing would NOT include those
files moved there by the other program UNLESS I waited "a while" before 
trying to get this list.  Both the system call and the CreateProcess call
I used are designed to wait for the termination of the called process before
continuing, just as you state and want.  When I noticed this problem, I tried
getting the directory listing both by invoking "DIR" through another system 
call and by using direct code calls to _findfirst()/_findnext().  I got the
same results with both approaches.  The amount of time that was necessary 
to wait before these new files would show up in this listing was somewhat
variable and unexplainable in my tests.  You may find things different in
your case; I don't know.  This problem did NOT occur for me on NT though...

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list