I am trying to read source code of a webpage in C++. I haven't gone too much of a way. Can I read it as a text File??

Re: Reading Source code of a webpage 80 80

I don't think you can do this with standard c++. Or if you can, you may need third party libraries. A quick search suggests going with the microsoft windows option would seem the easiest.

[search]c++ read webpage[/search]
Look at the msdn website and the documentation for wininet perhaps?

Re: Reading Source code of a webpage 80 80

using libcurl would be a portable way. http://curl.haxx.se/libcurl
source or binaries for a number of platforms are available http://curl.haxx.se/download.html

libcurl can be used directly from c++. curlpp gives a c++ wrapper that uses stl, is exception and type safe; so you may want to use it.

you could also use curl from the command line.
to retriev a number of web pages (eg. to mirror a complete website), use wget
for windows: http://www.christopherlewis.com/WGet/WGetFiles.htm

commented: nice post!{i didn't know about libcurl} +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.