Thread: view source of html file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date
    May 2004
    Posts
    55
    or you can just right click and press "View Source" in internet explorer... doh

  2. #2
    C++ n00bie :D
    Join Date
    Jul 2004
    Posts
    63
    >>...both feof and eof.
    Whoops, didnt notice it was both.

    >>..."viewsource" in internet explorer... doh
    Thats true...

    Oh and, both my codes are screwed, and since it aint really my coding, I aint gonna work to fix it. Should atleast give an idea

  3. #3
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Noxir
    or you can just right click and press "View Source" in internet explorer... doh
    Unless you wanted to write an HTML parser that checks for HTML 4.01 validated code, in which case that doesn't do you a whole hell of a lot of good.

    As for the question.. just go through the normal process of reading from a file. It'll work.. HTML code is just text to C++'s point of view.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    67
    Code:
    int main()
    {
    	//Method 1
    /*
    	char test[15];
    
    	ifstream b_file("http://www.yahoo.com/index.html");
    	b_file >> test;
    	b_file.close();
    
    	ofstream a_file("test1.txt");
    	a_file << test;
    	a_file.close();
    */
    
    	//Method 2
    /*
    	char* buffer=new char[255];
    	ifstream readfile("http://www.yaho.com/index.html");
    	for (int x = 0; x < 100; x++)
    	{
    		readfile.get(buffer, 255, '\n');
    		cout<<buffer;
    		readfile.close();
    	}
    */
    
    	// Method 3
    /*
    	char line[255];
    	int read, display;
    	ifstream readfile("http://www.yahoo.com/index.html");
    	for(read=0; read<255; read++)
    	{
    		readfile.get(line[read], 255, '\n');
    	}
    	readfile.close();
    	for(display=0; display<255;read++)
    	{
     		cout<<line[display]<<endl;
    	}
    */
    }
    1. displays a few weird characters
    2. displays nothing
    3. compile error

    note: i changed the code you gave me cuz my compiler doesn't like std:: or string

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. Source file inclusion
    By sh3rpa in forum C++ Programming
    Replies: 7
    Last Post: 10-02-2007, 11:10 AM
  3. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 05:23 AM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM