I had to do this for an analysis program on a slightly larger scale. If you are looking to send this request to many hosts, then it is easiest to use NMAP to ping the list. It outputs a line like this:
> nmap -sP -n IP1 IP2 IP3 IP4
Starting Nmap 4.53 (
http://insecure.org ) at 2008-10-23 09:22 EDT
Host IP1 appears to be up.
Host IP3 appears to be up.
Nmap done: 1 IP address (1 host up) scanned in 0.030 seconds
If you ignore the first line and the last line, then you have a list of all of the IPs that are up and in a very-easy-to-parse fashion. You can use gryphon's output trick to read it into your program.
If you want to follow jsmith's advice, then I recommend reading Beej's guide to network programming:
http://www.beej.us/guide/bgnet/
It will give you a basic network programming primer. From there you could read this:
http://www.codeproject.com/KB/IP/Ping_and_Traceroute.aspx
Which shows how to create a very basic ping implementation that you could use for this purpose.
If you get it implemented, post the results here so other people could use it; I have a feeling lots of people would like that :-)