Thread: opening an external file

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    1

    Question opening an external file

    I am just learning C++ and I was wondering, is there a way to make a .exe file that when ran automaticlly opens a .html document? I'm asking becaue I am putting thewebsite for my business on CD-Rom and autoplay only works for .exe and .com(Ithink) extensions, but not .html.

    I need to be able to have Autoplay.ini open auto.exe which opens index.html automaticlly.

    Thank You for any help,

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    look up ShellExecute() on MSDN

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    26
    I am not sure but i think u can use the system function

    PHP Code:

    #include <iostream>
    using namespace std;

    int main ()
     {
      
    system("file.html");
      return 
    0;
      } 

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    nah that wouldn't work

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    26
    I tested it, and it works fine!!

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    not on my computer, punk!

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    26
    i tested on Dev-C++ and Borland 6, and its working on both!!
    i am using XP but i dont think that makes a different.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    26
    Here is the exe file in case u dont believe me! :P

  9. #9
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    that exe did nothing - it just quit as soon as i opened it

  10. #10
    Registered User
    Join Date
    Apr 2002
    Posts
    26
    There should be a file named with "file.html" in the same directory where the executable is! or it will open nothing!

  11. #11

    Smile

    it definatly works for me

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM