$ echo -en 'this is fun!\x00oh no, it copies after nul byte!' | ./a.out | hexdump -C
00000000 74 68 69 73 20 69 73 20 66 75 6e 21 00 6f 68 20 |this is fun!.oh |
00000010 6e 6f 2c 20 69 74 20 63 6f 70 69 65 73 20 61 66 |no, it copies af|
00000020 74 65 72 20 6e 75 6c 20 62 79 74 65 21 00 00 00 |ter nul byte!...|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000100
$ ./a.out | hexdump -C
00000000 74 65 73 74 00 68 65 6c 6c 6f 00 00 00 00 00 00 |test.hello......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020