Thread: Newbie: string in system()

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    2

    Newbie: string in system()

    Hi, im trying have to my program get a user specified ip, then apply that ip to the end of system() as a command line option. help would be great thx!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Newbie: string in system()

    Originally posted by underplay
    Hi, im trying have to my program get a user specified ip, then apply that ip to the end of system() as a command line option. help would be great thx!
    strcat it to a buffer, system( buffer ).

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    2
    remember im newbie can u plz set an example?

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by underplay
    remember im newbie can u plz set an example?
    You need to try first, or at least give us a clue as to what direction we're going.

    Are you working with C++ strings or C strings (char arrays) ? I guess I'll have to explain with an example:

    Code:
    // C style string
    char ipaddress[30];
    std::cin >>ipaddress;
    
    // C++ style string
    std::string ipaddress;
    std::cin >>ipaddress;
    Which are you using?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    User input examples here.
    strcat() example here

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  2. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 06:52 PM
  3. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM