By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,136 Members | 1,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,136 IT Pros & Developers. It's quick & easy.

open a text file during the program

P: 8
Hi need some help from you guysin using visual C++. I am thinking of opening a text file after some calculation. For example, after i press the "calculation", then at the OnCalculation function, it will do some calcuation the it is written to a text file called "result.txt". Then i would like it to open the text file automatically after the calculation instead of i going to the folder to open it to view.

Anyone know how to do so? Thanks
Dec 18 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,916
Since it is a text file you have a couple of choices

Use either ShellExecute or CreateProcess to run a new program to display the file.

Either run it directly in Notepad, or run a command shell (cmd.exe) with the command line "start result.txt" which should open the file in whatever is the default program for text files on the computer if it has been changed from Notepad.
Dec 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.