Skip to main content
GameDev.net gamedev.net
🔒 Locked

execute program

Started by GravtyKlz Jan 24, 2006 at 8:25 PM 1 replies 450+ views
Original Post
GravtyKlz
GravtyKlz
I know this question has been asked before...but I cant find the answer. How do I execute a program with C++? In other words....Im creating a program that writes to a txt file....and after its done I want the program to open up the file with a txt editor and just close itself. Thanks.
ciroknight
ciroknight
try
system("notepad.exe textfile.txt");


It's actually ANSI-C, but I don't think your compiler's going to moan about that.

EDIT: I probably should tell you it's in the stdlib.h header, and if you want a version defined in the std namespace, you can use "include ;" instead. Then just add std:: to the beginning of the function, or declare "using namespace std;" at the top of the source file.
GravtyKlz
GravtyKlz
thanks that was quick...runs just like I wanted!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.