Thread: Storing an IP Address in a Variable?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1

    Storing an IP Address in a Variable?

    Hey everyone. I'm new here and I'm also a noob to C++, obviously.

    Is there a way to store an IP address into a variable with C++? I've been searching these forums as well as the Internet for probably a total of 6 hours these past couple of days, and have found nothing (or nothing I understand, at least.)

    I'd really appreciate any help that anyone can give me. Thanks in advance

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Well you could do
    Code:
    char IP[[]="127.0.0.1";
    There is the inet_atoi() function for coverting an IP in dotted ascii format to an integer suitable for use with socket functions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  2. Getting a grasp on pointers
    By lilrayray in forum C Programming
    Replies: 23
    Last Post: 07-26-2006, 06:58 PM
  3. systray app to get IP Address
    By bonkey in forum Windows Programming
    Replies: 17
    Last Post: 09-19-2003, 08:10 AM
  4. Replies: 8
    Last Post: 04-22-2002, 10:02 PM
  5. MSN Vital Information
    By iain in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-22-2001, 08:55 PM