Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to retrieve Public IP Address

How to retrieve Public IP Address

Scheduled Pinned Locked Moved C / C++ / MFC
c++comsysadmintestingtools
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gamefreak2291
    wrote on last edited by
    #1

    I'm currently working on a program that outputs the information given under ipconfig/all in DOS to a text file. Now even though this seems very simple do check normally, its for people who don't know dos commands and that sort of thing. However to make this program more effective I would like to have it output the Public IP address of a network, this can be done normally by visiting http://whatismyip.com The code is currently:

    #include #include #include int main()
    {
    system("ipconfig/all >> \"C:\\Documents and Settings\\gamefreak\\desktop\\test.txt\"");
    }

    which is working, now I'm trying to output the information provided by http://www.whatismyip.com/automation/n09230945.asp I suppose an answer on how to copy and paste all the information from a webpage in C++ would work the easiest.

    D 1 Reply Last reply
    0
    • G gamefreak2291

      I'm currently working on a program that outputs the information given under ipconfig/all in DOS to a text file. Now even though this seems very simple do check normally, its for people who don't know dos commands and that sort of thing. However to make this program more effective I would like to have it output the Public IP address of a network, this can be done normally by visiting http://whatismyip.com The code is currently:

      #include #include #include int main()
      {
      system("ipconfig/all >> \"C:\\Documents and Settings\\gamefreak\\desktop\\test.txt\"");
      }

      which is working, now I'm trying to output the information provided by http://www.whatismyip.com/automation/n09230945.asp I suppose an answer on how to copy and paste all the information from a webpage in C++ would work the easiest.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you tried InternetReadFile()? I just tried and it seemed to work fine.

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      G 1 Reply Last reply
      0
      • D David Crow

        Have you tried InternetReadFile()? I just tried and it seemed to work fine.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        G Offline
        G Offline
        gamefreak2291
        wrote on last edited by
        #3

        No I have not tried InternetReadFile(), I looked into to it and I can't seem to get it to work.. I'm not very good when it comes to Win API functions

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups