cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Open a text file in notepad using c++
Open a text file in notepad using c++
Mar 14, 2010 at 8:24am UTC
ToniAz
(351)
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
Mar 14, 2010 at 8:29am UTC
bluecoder
(763)
by using cocreateInstance function for notepad.exe
Mar 14, 2010 at 11:54am UTC
Duthomhas
(13206)
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.