+2  A: 

A better method for capturing output than system() is to use popen() instead. That way you can capture the output of the command without using a temporary file.

A better method for pinging is to use the Microsoft ICMP API (an introductory page can be found here). This will be possible if your C compiler has the ability to call arbitrary Win32 API functions. In particular, IcmpSendEcho is the function you would want.

Greg Hewgill
Thanks again.I will definitely look into this..
Enjoy coding
+2  A: 

Another option is using raw sockets for sending/receiving ICMP packets yourself, or using a library such as libnet for that. You can then take your measurements at a finer granularity. It'll take some time and getting used to, though. :)

Michael Foukarakis