I was planning on building a current logging device with an Arduino, and tried starting off with the basic SD-card write example from the Arduino IDE sketchbook.
The Serial console showed no errors, so I assumed everything worked perfectly.
However... when I inserted the card in my computer (Ubuntu 18.04) and opened it with gedit, the file was blank? Vim had the same behaviour: it was blank.
But... when I used cat on the file, it DID show the contents?!
Anyone have a clue what I did wrong here?
EDIT: in reponse to Bodo's question:
output of cat:
(This is what's supposed to be in there)
out put of ls -l:
-rw-r--r-- 1 myname myname 15161 Jan 1 2000 DATALOG.TXT
output of od -c -tx1 DATALOG.TXT | head -1 :
0000000 \r \n \r \n \r \n \r \n \r \n \r \n \r \n \r \n
This last one answerd the question to me... It shows a bunch of newlines. But really... A LOT... This explains why gedit and vim showed empty files. I have to scroll down for ages before seeing the actual data. When using cat, I only saw the trailing lines, so it showed the contents. Probably something that went wrong when saving the data to the SD-card. Thanks Bodo! You solved my problem merely by posing a question :D