Thread: passing a parameter to a system invoke

  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-31-2002, 12:34 AM
  4. Passing system time to a function
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2002, 01:56 PM
  5. parameter passing
    By Jax in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 05:24 AM