Misel89
Posts: 1
Joined: Thu Jul 04, 2019 12:52 pm

Can not read the whole txt file content

Sat Jun 19, 2021 1:31 pm

Hi,
On my raspberry i'm writing logs in txt file. And sometimes some wird character is written in file that my code does not read then the whole file.

First two images are from respberry where only first line is readed. In last picture i copy file to windows and open with notepad++ and see all lines. I also see some null,null,... after the line i was able to read.

In production we can not copy files to windows thats why i need urgent fix,...


Image

deepo
Posts: 831
Joined: Sun Dec 30, 2018 8:36 pm
Location: Denmark

Re: Can not read the whole txt file content

Sun Jun 20, 2021 12:35 pm

Not an easy thing to help with without seeing the code that writes the file.
Can you show the code?

swampdog
Posts: 722
Joined: Fri Dec 04, 2015 11:22 am

Re: Can not read the whole txt file content

Fri Jun 25, 2021 1:42 am

On the rpi 'hexdump -Cv' (and 'less') will save you copying the file to a PC.

As it looks like there may be zero character codes in there it'll be likely your code is writing nul and/or null. You need to post the relevant code section for help.

Return to “General programming discussion”