Thread: get program to open a html file

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    66

    get program to open a html file

    How do I get my program to open a file on my computer i.e an html file in a browser.

    by the way it is windows 98.
    T

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    system( "iexplore myhtml.html" );

    I believe that will work.

    Quzah.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Unless you use netscape(or any other broswer), so instead of the iexplorer use the netspace's program(the exe) file!
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    C'mon, read the FAQ

    ShellExecute gives you the most flexibility (starts documents as well as files, for example).

    So you just use ShellExecute with the html file, and it opens your default browser.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Exclamation Good point

    Good point!!!

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    66
    As I am only just learning 'C' I don't really have a clue about all the more complicated options. All I want is something that does the job but I have tried system(); and I can't get it to work. I always get a message ( Linker error : Undefined symbol _system in module myprogram.c. I have included stdlib.h. Does anyone know why this is.
    T

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Which compiler are you using (I see you're using win98).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Get Dev C++, or at least Borland C++, these are the only compilers(on win32) that are really good, for both beginners and advance C programmers.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  9. #9
    Registered User
    Join Date
    Oct 2001
    Posts
    66
    I have Borland C++. I have 2 versions 1 allows the system function the other does'nt. The one that does, I can get it to access a .exe file but not a .html file and cant work out why this is
    T

  10. #10
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i wonder how do you access the exe files... ohh.... let me guess:
    system(cool.exe);

    come on, you got to be kidding... an html files aren't running through the OS, but the broswer!
    Last edited by Devil Panther; 11-08-2001 at 05:58 AM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    66
    critisism 10 helpful advice 0

    thanx for that but how do I get my .html to open.
    T

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > critisism 10 helpful advice 0
    >
    > thanx for that but how do I get my .html to open.

    Hey, you ungreatful piece of crap, why don't you READ what everyone wrote. EVERY post was helpful. Let me recap this for you:

    You: "help!"
    Me: "Ok, try 'system()'.
    Devil: "Use this slight modification if you're using netscape..."
    Salem: "Read the FAQ, ShellExecute is better."
    Devil: "Good point".
    You: "I'm a n00b. I'm getting errors with 'system()'"
    Salem: "What compiler?"
    Devil: "Get such and such, it's a good compiler."
    You: "I have Borland. I donno how."
    Devil: "Um, we already told you: 'system( myexe myargs )'"
    You: "Waaaah! No one loves me! I'm a dolt! You all suck!"
    Me: "You're a moron. We did help."

    See? I can be a critic if needed. We weren't. EVERY post gave you helpful advice. Did we get any thanks? No, just a smart ass. People wonder why we jump on people that ask questions that are in the FAQ; well you, my friend, are a living example of why.

    Quzah.
    Hope is the first step on the road to disappointment.

  13. #13
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    wtf was that all about???
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  14. #14
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    801
    I thought you could read a HTML file with fscanf.

    html file is just a simple text file, isn't it. (Before it gets through the brouser that is)
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: [email protected] []*[]

  15. #15
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Read ---- yes
    open in a browser with fscanf() ----- No Way man!
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. change this program to open a file
    By A F Army in forum C Programming
    Replies: 3
    Last Post: 04-05-2003, 05:25 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM