Maybe this question has already popped up somewhere, but I'm new to this
forum and there is apparently no way to search the past questions and
answers...
I have written a script that needs to produce binary files. I am using active perl
on windows.
I am using the function "pack" to get the bytes into the binary file.
So for instance pack("c", 0x41); results in getting the character "A" into
the file. However, if I do: pack("c", 10); , I think I should get 0x0A in my file
but instead it puts 2 bytes in the file, 0x0D, 0x0A.
Could anybody tell me how to enter exactly what I want and no extra bytes?
Here is a sample code:
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- open(outfile, ">Test.bin");
- print outfile pack("C", 10);
- close(outfile);
file produced has 2 bytes instead of one.
Thanks for any hint,
Pascal