logFile.close

PaulS:

its the easiers way.. to leave it open

Sure, but it's not the right way.

So your advice open file write data and close it .. next 5 min open it again etc.. OK ., so window for crashing file is very small(only during writing)

Yes, it is.

But will the program or file know where the put the next line, is the pointer where the last character is written alway known, when i open the file again?

Depends on how you open the file. If you open in append mode, then, yes, the write pointer is positioned at the end of the file.

So a flush will save it directly , what will do en close instruction , save an EOF???

Each time you call the write() (or print() or println()) method, data is written to a buffer. The flush() method actually causes a write to the file, copying the buffer contents into the file. The close() method calls flush(). Closing the file does write an EOF into the file, while flush() does not.

OK thx for information

so only difference is the EOF , in my case . This could course a corrupt file , because it is not properly closed

file corrupt dectetion
can i detect it by . if file SD.exist then , try SD.open

a File object referring to the opened file; if the file couldn't be opened, this object will evaluate to false in a boolean context, i.e. you can test the return value with "if (f)".