3 ms·
Shouldn't this be fwrite("Hello, world!\n", 1, 14, stdout) instead? After all, the string is 14 characters in length, not including the terminating NUL ch
by radiospiel 6y ago
Shouldn't this be
fwrite("Hello, world!\n", 1, 14, stdout)
instead? After all, the string is 14 characters in length, not including the terminating NUL char. What does writing a NUL char to stdout do, anyways?
- AlEinstein 6y agoYou are correct! To answer your question, writing a NUL char to stdout is no problem. Some utilities can actually use it as a delimiter since it’s so uncommon. I think most shells would just print nothing on the screen.
- joesavage 6y agoOops, quite right. I’ll try and push up a correction later today. Thanks!