Here's the python(3.4) code:
test = open('test.txt', 'r+')
test.truncate();
i = 0
stop = 99
while i <= stop:
test.write("{:0>{}}|".format(i, len(str(stop))))
i += 1
print(test.read())
It writes the file just fine, but it won't print it for some reason.
test = open('test.txt', 'r+')
print(test.read())
This prints it as expected, so I don't know where the issue may be.
Update:
Using seek(0) solved it. Can you link an explanation about it, please? I can't find it in the language's documentation.