Ask coding questions

← Back to all posts
Why is it not working?
[deleted]

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 (5152) [earned 5 cycles]
View Answer
Comments
hotnewtop
SixBeeps (5152)

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

SixBeeps (5152)

@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)

[deleted]

@SixBeeps ok thanks :)

[deleted]

@AJDevelopment

its now 16384