Thread: why is it not pulling up the text from online source?

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    4

    why is it not pulling up the text from online source?

    I have tried using get/put to use a copy of the text on the internet with no avail but however I am still getting an error as well I am having an issue creating the part that calls the parts of the function together that ask ASCIIsum, Double space delete, and the word counter into the function should I have an extra section that calls these functions and if so how do I construct it properly?
    Code:
    int getput()
    {
    string what goes here????;
    fstream streamObject("http://www.gutenberg.org/cache/epub/1342/pg1342.txt");
    fstream localFile("pap.txt");
    fstream newFile("new.txt");
    
    
    
        if(streamObject.fail())
            cout << "file failed to load." << endl;
        else
            cout << "file load was successful." << endl;
    
        if(localFile.fail())
            cout << "file2 failed to load." << endl;
        else
            cout << "file load was successful." << endl;
    
        while(!streamObject.eof())
        {
            streamObject.put(localFile.get());
        }
    
        streamObject.close();
    
        char single = localFile.get();
        while(!localFile.eof())
        {
            what goes here???? += single;
            single = localFile.get();
    
        }
        localFile << newFile;
    
        localFile.close();
    
        asciistring(what goes here????);
        doubledelete(what goes here????);
        numberwordsinstring(what goes here????);
    
    
    
    
    
        return 0;
    
    }

  2. #2
    Registered User
    Join Date
    Apr 2012
    Posts
    4
    Code:
     
    asciistring(what goes here????);
    doubledelete(what goes here????); numberwordsinstring(what goes here????);
    is all programmed out but I am not sure how to place them in the file as well I can post them if needed as well I really dont know what goes there that is why its like that lol

  3. #3
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Code:
    fstream streamObject("http://www.gutenberg.org/cache/epub/1342/pg1342.txt");
    sorry. fstream works only for local files.
    Kurt

  4. #4
    Registered User
    Join Date
    Apr 2012
    Posts
    4
    agh that explains alot so how would I go about pulling it from an online source?

  5. #5
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    You could use cURL, or read up on sockets and network programming and do it by hand.
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pulling source code?
    By cabers in forum C Programming
    Replies: 2
    Last Post: 03-23-2011, 05:59 PM
  2. Read in an online text file
    By darko886 in forum C Programming
    Replies: 6
    Last Post: 03-19-2010, 05:40 PM
  3. Read source from a HTML online
    By tboy in forum C Programming
    Replies: 2
    Last Post: 11-22-2004, 08:10 PM
  4. Open Source Text Editors
    By Cxx in forum C++ Programming
    Replies: 2
    Last Post: 01-04-2003, 03:46 AM
  5. Need Help with Text Based Online RPG
    By dirty-laundry in forum Game Programming
    Replies: 0
    Last Post: 01-09-2002, 02:17 PM

Tags for this Thread