Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am executing cmd.exe commands via a C program with the CreateProcess function. I check to see if cmd.exe has terminated with the GetExitCodeProcess function, by checking to see if the process exit code equals anything except STILL_ACTIVE. This works fine with commands like "cmd /c echo Hello World", but for commands like "cmd /c dir c:\test", cmd.exe will never terminate if the directory contains more than 60 entries, cmd.exe will terminate if there are 60 or less entries in the directory. Does anyone know why it behaves like this? Thanks a lot.
Posted
Updated 15-Dec-12 3:02am
v4

1 solution

Apparently I have to start to read the stdout/stderr pipe in the loop which checks to see if the process is still running, as well as read it after the process has terminated. Rather than just read it after the process has terminated.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900