What you can you is call the 'ping' from inside you program using the system() function. In your call you can redirect the output of ping to a file. After ping did its job, you can read the contents of the file and sort the data based on your needs.
^ from some other thread....
i have tried to a_file<<system(Doscommand)<<endl; but all that will return is 0... so help me i have been trying this forever grrrr...