I need to create a script that converts a 4 byte input into its reversed form. I imagine the basic algorithm is something like
- Read input from STDIN
- Convert to byte array
- Reverse the array
- Write bytes on STDOUT
Any help greatly appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It reads four bytes from
STDIN, unpacks the string as a list of 8 bit unsigned integers, reverses the list and then packs it back as 8 bit unsigned integers.