Ask coding questions

← Back to all posts
Why is it not working?
AJDevelopment (68)

So I was testing out a write file function I wrote after adapting some code from OSTEP. This happened and I was confused. So the first time it wouldn't print the last character into the file so I fixed some stuff and this happened.

Answered by SixBeeps (3186) [earned 5 cycles]
View Answer
Commentshotnewtop
SixBeeps (3186)

That looks like an encoding issue. Where is write() from?

SixBeeps (3186)

@AJDevelopment Wait, when you call write(), you set the length parameter to 13. It should be the size of the string (in the example in the PDF, "hello world\n" has 13 characters)