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