-p pattern
You may specify up to 16 ``pad'' bytes to fill out
the packet you send. This is useful for diagnosing
data-dependent problems in a network. For example,
-p ff will cause the sent packet to be filled with
all ones.
see man pages for more info
# man ping
for sample source code you can use the source code of ping ))