SD CARD Create File and then Read Directory Problem

SurferTim:
Try this.

dataFile = SD.open("TEST.CSV", FILE_WRITE);

Use this to "truncate"...

SD.remove("TEST.CSV");

... then open for writing and it is empty.

Hey, what do you mean by "truncate" the file?

Does the file need to be "open" in order for "remove" to work?

More generally, what does "SD.remove(filename)" actually do? I'm having problems where I'll do something like

if(!SD.remove(filename))
{
    Serial.println("File removal failed");
}
else
{
    Serial.println("File successfully removed");
}

and it prints the "Success" message to the serial monitor, which leads me to believe that the file was removed. However, when I run the "listfiles" sketch from the Arduino SD Library Examples, it says that the file I tried to delete is there with some filesize.

Does SD.remove actually remove the file, and all its contents from the SD card? This may seem like a dumb question, but I've had a reasonable amount of success with the other SD functions. Remove is just not working like I expect it to.

Thanks.