Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Idiot + C++ = c the idiot

    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.

    Thank you!
    -Kenny V

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.
    Last edited by Mhtml; 02-08-2005 at 03:26 AM.
    Omnis mico antequam dominus Spookster!

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I concur. Except I would use ShellExecute (again, from the Win32 API) instead of CreateProcess.

    shmoove

  • #4
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Yeah that's what I wanted to say but I couldn't think of the name of the function so I just said createprocess.
    Omnis mico antequam dominus Spookster!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •