![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | cgeadas |
With the following code I’m having the file truncated, not appended.
if ficheiro.open(nome_ficheiro, File.READ_WRITE) == OK:
ficheiro.store_line(linha)
ficheiro.close()
Is this supposed to erase the contents of the file?
I had the idea that, for truncating, there is WRITE_READ. Is this a bug?
Also, is there a way to create a file if it does not exist and ONLY append if it exists?
(I mean another way besides reading the file and writing it back all together)
I think the string has to be in quotations
Merlin1846 | 2020-03-20 03:29
But this code writes the string successfully.
The point is that it does not append a new line to the file as it should but instead deletes the string it was saved there before and writes the new one. So, instead of getting a file with a content like this:
StringRun1
StringRun2
StringRun3
I get:
StringRun3
cgeadas | 2020-03-20 04:32