• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

create a folder, or use any DOS commands, in C++

metal

n00b
Joined
Dec 15, 2003
Messages
35
I'm creating a simple console app in c++, what is the best way to create a folder from this application? Also, is there any way to use DOS commands from a c++ console app? If so, I could just use md or mkdir. Thanks for any help in advance.
 
one more question, implementing the system("mkdir") is there any way to use a variable in the folder name? I need to create a new folder in a for loop, named "Client ".... to get Client 1, Client 2, Client 3, etc...can this be done?
 
You pass a string to 'system()'... if you build the string it works just the same...
 
Careful passing strings to a function like that. A user could inject some nasty commands into it. Parse an user input carefully, especially be careful to remove "&". But i guess thats being a little paranoid, its all about who is using the application and what context it is running in. If its running on a server, then that would be a major concern.

For example, if its running on the server and you input "myfolder && format C: /s" as the folder name, your program would be running whatever command the user wants. If its running on a users machine, then the user is just hurting themselves ;-)
 
thanks for all the input.
actually, this is just a program to generate the configuration files required to play duke nukem 3d over a network, so I don't think there's a security issue there.
 
Back
Top