Thread: Trying to launch a site!!!! Please HELP!!!

  1. #16
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    If it isn't too much, could someone direct me to a site where batch files are explained/taught? Maybe a tut?
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  2. #17
    King of the Internet Fahrenheit's Avatar
    Join Date
    Oct 2001
    Posts
    128
    http://www.computerhope.com/batch.htm

    First link off googling for "Batch Files" ...

  3. #18
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    Codeplug,

    I hate to ask this, but does this write a string to the ie?
    I do not have a compiler available to test this code.
    It looks like your are using the output stream to send the passed address to a file named temp.url then the file is executed by a system command. Is this an accurate description? Does the code work?
    Again I'm sorry I've never seen this or have a compiler to test it.
    I'm also currious where you use <string>. I do not see any string declarations.

    Code:
     #include <fstream>
    #include <string>
    #include <cstdlib>
    using namespace std;
    
    
    bool launch_url(const char *url)
    {
        ofstream out("temp.url");
    
        if (!out)
            return false;
    
        out << "[InternetShortcut]" << endl 
            << "URL=" << url << endl;
    
        out.close();
    
        return system("temp.url") != -1;
    }//launch_url
    
    
    int main()
    {
        launch_url("www.google.com");
    
        return 0;
    }//main
    Last edited by xviddivxoggmp3; 12-27-2003 at 12:13 AM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  4. #19
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Here is a list of compilers, most of which are free to download.

    >> It looks like your are using the output stream to send the passed address to a file named temp.url then the file is executed by a system command.
    That's exactly what it does. You can use fopen() and fwrite() if that's what you know and are comfortable with.
    The system() function simply passes the string argument to the command interpreter and runs it as if you typed that string in at the C:\ prompt.
    Windows will "execute" the .url file as if it were an exe (try it out by creating a .url file with notepad).

    >> Does the code work?
    Of course

    >> I do not see any string declarations
    No, I didn't use any string's so I didn't really need <string>.

    gg

  5. #20
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    codeplug...

    Thanks for the details.
    That is a handy little bit of code.
    I actually have mcvc++.net7, but i do the majority of my surfing at work, and they will not allow me a compiler on my machine.
    I hope you do not mind, but I will be putting this into my library of fun stuff to pick from for my programs. Good thread.

    thanks.
    xddxogm3
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting HTTP status of a site in C under Linux
    By anti4kd in forum C++ Programming
    Replies: 3
    Last Post: 01-03-2009, 01:56 PM