Thread: System ping Linux questions

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    44

    System ping Linux questions

    I am trying to write a C++ function to do a ping on a known IP address and then parse the output to see if "1 packet transmitted, 1 received..." is printed.

    I am new to this kind of programming and these commands and using Linux.

    I am thinking something along the lines of

    system("ping IP_ADDR_DEFINE -c 1");

    to start with , but don't to where to go from here to save the output and parse the output.

    Any help would be greatly appreciated.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,314
    You'll be wanting this then.
    popen(3) - Linux manual page
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    44
    Quote Originally Posted by Salem View Post
    You'll be wanting this then.
    popen(3) - Linux manual page
    Can you please provide me with an example of how to use that function in junction with ping?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,314
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do i ping some IPs through "system" function?
    By sparkle in forum C Programming
    Replies: 3
    Last Post: 01-13-2009, 02:59 AM
  2. A few questions on system()
    By Jetlaw in forum C++ Programming
    Replies: 5
    Last Post: 03-30-2006, 10:38 AM
  3. Bitmap Rotation System Questions
    By loopshot in forum Game Programming
    Replies: 2
    Last Post: 05-13-2005, 01:32 PM
  4. system software....many questions
    By planet_abhi in forum Tech Board
    Replies: 4
    Last Post: 04-26-2003, 03:52 AM

Tags for this Thread