Thread: Calling a webpage

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    1

    Calling a webpage

    Hello

    I'm extremely new to programming. So new, I learned a tiny bit of Pascal last week for the first time. I've moved onto 'C' because my friend is a programmer and finds 'C' easier to teach.

    I would like to call a webpage. I'm already using the following code to call my webbrowser:

    Code:
    _spawnl( _P_DETACH ,"C:\\PROGRA~1\\INTERN~1\\iexplore.exe",NULL);

    As you can probably guess, my friend helped me with that. He used that instead of system() (which I tried to use) because it opens the process in a new thread. (Is that right?).

    Anyway, using the above code, is there any way to open a browser at a specific page? It needs to allow the rest of my programming to continue working, which system() did not.

    I'm sorry if this is basic, but I've never programmed in my life. Many Thanks for any help.

    Lee

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I would guess you should not ignore the extra arguments to _spawnl, but instead use them to pass the name of the site you want opened between the "iexplore.exe" and the NULL.

    (Also, your belief that system() did not allow "the rest of your program[] to continue working" is false. Like many languages, C executes statements in order, so the next statement in the row will happen just as soon as this one finishes, that is, when the system call finishes.)

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    > "C:\\PROGRA~1\\INTERN~1\\iexplore.exe"
    Are you using an old compiler which doesn't understand spaces in filenames, nor filenames longer than 8 characters?
    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.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    > "C:\\PROGRA~1\\INTERN~1\\iexplore.exe"
    Are you using an old compiler which doesn't understand spaces in filenames, nor filenames longer than 8 characters?
    I bet it's another Turbo C user... And Turbo C doesn't allow long filenames [or it's a copy''paste from Turbo Pascal or some such].

    Not to mention "What happens if I have deleted my internet explorer and replaced it with Firefox?"

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Or working on it anyways mramazing's Avatar
    Join Date
    Dec 2005
    Location
    Lehi, UT
    Posts
    121
    Internet explorer has command line arguments to open webpages. But why are you using iexplorer? and is spawnl a windows specific thing similar to exec?
    -- Will you show me how to c++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack issues when calling a COM library
    By notnot in forum C Programming
    Replies: 3
    Last Post: 06-01-2009, 02:12 AM
  2. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  3. calling default instead of argument constructor, why?!
    By cppn00b in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2005, 04:24 AM
  4. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM
  5. calling c++ program from a webpage
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-04-2001, 09:41 AM