hi, I'm trying to write a c++ program in Dev C++, I want it to find the ip Address of a Windows pc, and output it in normal text, I've searched the internet, but none of all the forums and opics seemed to help me much, I'm still not very familiar with C++, but I'm not a beginner, so please can you help me, step by step, on how to write a program to do this?
Thanks for your quick replies, Athar, can you please specify more in detail the second point in your reply. Oh, and how can I Download the link you gave me, did you mean that somehow I should get it's code( just a guess )? Please reply soon, thanks.
Oh, and how can I Download the link you gave me, did you mean that somehow I should get it's code( just a guess )?
Yeah, that's pretty much what downloading means.
To do it, refer to the libcurl examples. The two examples "fopen() URL" and "get a remote file in memory only" sound particularly promising.
If you don't want to use libcurl, look for descriptions of the HTTP protocol.
Basically you just need to send this:
GET / HTTP/1.1
Host: checkip.dyndns.com
Connection: close
and strip the HTTP header of the received data.
Tenomig wrote:
Thanks for your quick replies, Athar, can you please specify more in detail the second point in your reply.
Well, the dyndns page looks like this:
<html><head><title>Current IP Check</title></head><body>Current IP Address: xx.xx.xx.xx</body></html>
Since you don't need all that unnecessary stuff, you can determine the position of "Current IP Address:" in the page and then get all characters until the '<' of </body> appears.