[Tfug] How do you remove a file from a USB vfat - in c

jblais joe.blais at pti-instruments.com
Thu Nov 8 12:03:18 MST 2007


Hello

this is another of my dumb questions

I'm trying to use a USB sick with vfat -- sorry, it has to be seen
eventually by winders.

The issue is this.  In C I just do remove("filename");  and for Linux (ext2
?) the file length is set to 0, and the OS does the rest.  For the vfat
partition, just setting the length to 0 doesn't do the trick.  Initially the
file "looks" to have been removed, but when I re-mount the USB stick, it's
there as a 0 length file, which can get copied to my local Linux drive, and
from there I need to deal with the ugliness that's it's 0 length.  I guess I
could add a bunch of checks for 0 length in everything, like listing folder
contents, selecting files, opening files, deleting files.. But eventually I
do need to literally remove the file...

I did a google thing, and got mostly a bunch of command line stuff, which
may work, but I'd like to know how to do it from c --

Anyway - thanks for any help..

Joe





More information about the tfug mailing list