NoahVerner
NoahVerner

Reputation: 867

Does "\n" require 1 byte when passed to the function write()?

I just want to know if a line break (i.e. '\n') can only be written to the stdout if 1 byte is used for such, I mean, does a line break have to be called like this?

write(1, "\n", 1);

or can it be called like this?

write(1, "\n", 0);

Upvotes: 0

Views: 116

Answers (1)

Bytes are bytes. There's nothing magical about \n that makes it not count. It has to be the former.

Upvotes: 8

Related Questions