Find the answer to your Linux question:
Results 1 to 3 of 3
i want to zero pad some data to be sent. i want the zeros to be put in the end. for example that i want to zero pad the icmp ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    11

    zero padding


    i want to zero pad some data to be sent. i want the zeros to be put in the end. for example that i want to zero pad the icmp data to be a total of 60 bytes. does anyone know how to do that?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,508
    Code:
    memset((void*)icmpdata, 0, 60);
    All you need is the address of the icmp data element in the structure that you are going to send.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    11
    memset() function fills the first n bytes of the memory area pointed to be s with the constant byte c. so the memset does the 123 to 0000000000123 or to 1230000000000. i want to do the second one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •