Line Ending patterns are different in various operation system
Windows / MS-Dos: [CR][LF] 0d 0a
Mac: [CR] 0d
Unix/Linux: [LF] oa
// You will find many "0x0a 0x0d" hex code pattern in the dump of windows file
# hexdump File.h.win32 | grep 0a0d
0000010 3e68 0a0d 6923 636e 756c 6564 3c20 7473
[omit]
0000220 6365 3b74 0a0d 0a0d 2a2f 202a 7546 636e
0000260 3b29 0a0d 6f76 6469 4220 6675 6566 4d72
0000280 6820 6e61 6c64 7265 3b29 0a0d 6e69 2074
// after we convert the file from windows file mode to unix file mode, we will no more see the pattern "0a0d"
# dos2unix -n File.h.unix File.h.win32
# hexdump File.h.unix | grep 0a0d
We can use dos2unix command to do the code translation, the command format is as following
# dos2unix -n Windows-text-original-file Unx-text-destinated-file
沒有留言:
張貼留言