Search code examples
visual-c++systemcmdmkdir

how to make the cmd window go away when running a system command in c++


I am using c++.NET and my program needs to make a directory

I normally do this with the system command

system("mkdir");

but when I do this command in my gui program this cmd window comes in and disapears again is there any way to do the command without that window showing up?

or is there a easier way to make a directory in c++?

thanks

luck


Solution

  • CreateDirectory ( http://msdn.microsoft.com/en-us/library/aa363855%28VS.85%29.aspx ) is an easier way, though you have to create any intermediate directories yourself.

    Alternatively you can use CreateProcess to launch a console with the flag CREATE_NO_WINDOW (and remember to wait for the process to terminate).