View Full Version : Idiot + C++ = c the idiot
02-07-2005, 01:49 AM
Alrighty, I need to create a basic app that can make & save a basic html file, and then execute it. If it already exists, then it will just execute the already existing file. Also, the c++ file needs to get the directory it's in (Ie: C:\Program Files... ...)
If it's alot of work, links to c++ tutorials would be great.
02-07-2005, 06:43 AM
Well I suggest using fstream to write the file, google will find you some good tutorials I'm sure so just search for "c++ fstream tutorial" or something.
If you are unable to open a file then it quite possibly doesn't exist, it could also be locked but that's unlikely with a simple text document so if you fail to get a handle to the file stream it doesnt exist.
You can use CreateProcess() to load the file. (I assume you're using Win32)
If you can make a start on it for yourself there are more than enough people here to help you if you get stuck.
If you need help finding a decent tutorial I'm sure someone knows a good one, quite possibly you'll find a site in the sticky thread at the top of this forum which will have an fstream tutorial.
02-07-2005, 08:02 AM
I concur. Except I would use ShellExecute (again, from the Win32 API) instead of CreateProcess.
02-07-2005, 09:44 AM
Yeah that's what I wanted to say but I couldn't think of the name of the function so I just said createprocess.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.