Thread: Opening a webpage with C++

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    20

    Opening a webpage with C++

    I need to write a program that will tell IE to open a webpage of my choice. The reason I need this is because it is one part of a larger program. Could anyone please help me? Thank you.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    faq.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    20
    Thanks. One more question:
    Is it possible to read a range of characters. Like say I want to read character 5-10 from a text file. How would I do that?

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Code:
    ifstream fin("myfile.txt");
    char ch;
    char * buffer [6];
    
    for(int i = 0; i < 5; ++i)
    {
      fin >> ch;
    }
    
    getline(buffer, 5);
    Something like that ought to get the job done. Basically, you read the first 5 characters in but do nothing with them; then read in the characters you really want. This approach will go to hell in a hurry, however, if characters aren't where you think they're supposed to be. Instead I suggest reading in data up to a delimiter.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Quote Originally Posted by joshdick
    Code:
    ifstream fin("myfile.txt");
    char ch;
    char* buffer[6];
    
    for(int i = 0; i < 5; ++i)
    {
      fin >> ch;
    }
    
    getline(buffer, 5);
    Shouldn't that be:
    Code:
    ifstream fin("myfile.txt");
    char ch;
    char buffer[6];
    
    for(int i = 0; i < 5; ++i)
    {
      fin >> ch;
    }
    
    fin.getline(buffer, 6);
    Last edited by 7stud; 04-25-2005 at 07:47 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 11-27-2007, 08:47 PM
  2. need help with file opening errors
    By lld4rkll in forum C++ Programming
    Replies: 6
    Last Post: 07-13-2006, 06:20 AM
  3. Opening A Webpage
    By bumfluff in forum C++ Programming
    Replies: 9
    Last Post: 05-10-2006, 01:21 AM
  4. Downloading a webpage onto the disk?
    By Edin in forum Windows Programming
    Replies: 3
    Last Post: 11-23-2004, 01:37 AM
  5. Opening a webpage
    By okinrus in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2003, 02:41 AM