passing a parameter to a system invoke

This is a discussion on passing a parameter to a system invoke within the C++ Programming forums, part of the General Programming Boards category; i want to make a system call to ping to verify if an address exists before sending data to it. ...

  1. #1
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385

    passing a parameter to a system invoke

    i want to make a system call to ping to verify if an address exists before sending data to it.

    so i can call ping using system("ping")
    but i want the user to be able to specify an address to verify
    eg:

    Enter IP:

    user enters 168.192.9.2
    the program calls a ping with the ip specified
    i cannot think of a way to do this
    the code i have tried doesnt work.
    Monday - what a way to spend a seventh of your life

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    get the ip address input as a string. Use string handling techniques to append that to the "ping.exe" or whatever.... store all that in a char array.
    then
    system(array);
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem passing double array as a function parameter
    By pppbigppp in forum C++ Programming
    Replies: 7
    Last Post: 06-06-2006, 03:08 AM
  2. Replies: 7
    Last Post: 04-19-2006, 11:17 AM
  3. Replies: 2
    Last Post: 03-30-2002, 11:34 PM
  4. Passing system time to a function
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2002, 12:56 PM
  5. parameter passing
    By Jax in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 04:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21