Nov 29, 2001, 8:59 AM
Post #2 of 3
If the server is running Linux, it most likely has the same byteorder (little endian). It's not OS specific, it only depends upon the used hardware, and Linux is most often used on Intel (little endian) machines.
I believe it has to do with the way you open and transfer files. When dealing with binary files (such as created by pack) be sure to always use binmode before reading/writing the file and be sure to always transfer (ftp) the file in binary mode. The big difference between Windows and Unix (including Linux) is the newline sequence. And if you print a packed string that contains a \n character in non-binary mode under Windows, it will be converted to a \r\n sequence, which is of course wrong for a binary file. Opening that file under Windows reverses that transform, so you end up with the correct data under Windows. But a Linux system will read the raw data, mixing up your binary packed string.
I hope this was your problem.