Open a text file in notepad using c++

Hello everyone,

I'm inputing data into a text file on disk using the fstream functions. But I can't seem, more like, do not know how to open the text file i.e. open it as if I would use my mouse and double click on the text file.

Thanks
by using cocreateInstance function for notepad.exe
Open the file and wait for the user to close Notepad:
system( "notepad.exe myfile.txt" );

To open the file and have your program continue running, you will need an OS-specific function. Choose one of CreateProcess() or ShellExecute[Ex]()
http://www.google.com/search?btnI=1&q=msdn+CreateProcess
http://www.google.com/search?btnI=1&q=msdn+ShellExecute
http://www.google.com/search?btnI=1&q=msdn+ShellExecuteEx
Choose the Ex version if you want to know when Notepad is closed, or close it yourself.

Hope this helps.
Topic archived. No new replies allowed.