-
October 26th, 2003, 04:38 AM
#1
Junior Member
C++ & Html
Hello;
I want to write a program that reads the source from a web site but i don't know which class/library to use. Any help would be appreciated... Thanx..
-
October 26th, 2003, 05:08 AM
#2
Ok I couldn't find the Library for this I am artually kind of interested in this myself just for shits and giggles. But I did come up with a Program this might not be what your looking for though.
I did a look and this is the thing that was really Close.(SP)
http://www.newty.de/lsc/index.html
Sorry First time I did it forgot to add the link.
-
October 26th, 2003, 05:15 AM
#3
Member
Try using fstream... I've never done it and don't have VC++ installed so you should:
Code:
#include <iostream>
#include <fstream>//includes ifstream class for file
//input and ofstream class for file output
using namespace std;
int main ()
{
ofstream fout; //creates an ofstream object named fout
fout.open("http://www.google.com");//fout opens the file "filename"
fout << "I am writing in a file!";
fout.close(); //closes the output connection to file //”filename.txt" (MS Word formatting is horrible, srry)
cout << "Press any key to end this program" << endl;
char x;
cin >> x;
return 0;
}
If that doesn't work, sorry, just a guess... but when/if you figure it out, post, I'd like to have some fun too.
[pong][shadow]Why won\'t anyone give me greenies???[/shadow] [/pong]
-
October 26th, 2003, 06:10 AM
#4
-
October 26th, 2003, 06:13 AM
#5
Member
Yup.. except as you can see I changed a part of it... and I even corrected parts of it if you remember.. hehe
And go ahead.. neg me.. make my day buddy...
I actually just gave a random thing from your tutorial and changed the filename.txt to something else to show where it goes.... but the point was to use the fstream header..
[pong][shadow]Why won\'t anyone give me greenies???[/shadow] [/pong]
-
October 26th, 2003, 06:21 AM
#6
//”filename.txt" (MS Word formatting is horrible, srry)
that was the part that gave it away...i remember being all pissed off at Microsoft Word for moving my code around... lol i dont enjoy negging people, i just want you to know that plagarism is a criminal act and you can go to jail for it and especially dont do it when the person who you are plagarising's home page is www.antionline.com and he reads every post that has the words C++ in the subject line
its all good...makes me feel proud that people actually read my tutorials and try to act like they wrote some of it
Support your right to arm bears.
^^This was the first video game which i played on an old win3.1 box
-
October 26th, 2003, 06:24 AM
#7
Member
Copying that short part of code would not even get a court to listen to you....
And I recommend you set homepage to www.java.sun.com .... its a whole lot better
[pong][shadow]Why won\'t anyone give me greenies???[/shadow] [/pong]
-
October 26th, 2003, 10:57 AM
#8
Code:
fout.open("http://www.google.com");//fout opens the file "filename"
There are at least two reasons why that won't work.
1. You are trying to open Google's home page for writing.
2. You are trying to use the iostream library for something which IT DOES NOT DO.
There may well be a third party library which extends iostream into, say httpistream, which can fetch files from URLs. But ifstream can't (And ofstream DEFINITELY can't)
Slarty
-
October 26th, 2003, 12:52 PM
#9
Junior Member
As slarty said, this doesn't work. When i search for what i was looking for in CodeGuru and these kind of sites, i came into WinSock APIs and WinHTTP & WININET libraries. But i couldn't find any information how to fetch a web site. (I'm thinking about myself being dumb). Thanx anyway, at least people answer and try to help.
-
October 26th, 2003, 05:10 PM
#10
Member
just use sockets (winsock in windows, all those libraries in *nix) to connect to the server and read in the webpage. this is an extremely easy program to write if you are familiar with socket programming.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|