Nulling out the filename in Turbo C 1.5

Rahul Dhesi dhesi at bsu-cs.UUCP
Sun Apr 24 03:34:25 AEST 1988


In article <554 at picuxa.UUCP> rcr at picuxa.UUCP (Richard Court ) writes:
>I would like to null out the entire filename from the FAT instead of just the
>first character.

I suspect you will get lots of replies telling you how to access the
file allocation table directly.

Don't.  Too many programmers hastily do low-level nonportable stuff,
and aren't around a year or two later when the software breaks and the
frustrated user has to switch to a new product.

I suggest the following portable approach.

Reserve a funny single-character filename for your own use.  Suppose it
is "@".  To remove the filename of your target file from the file
allocation table, you:

(a) delete any file called "@" if it exists
(b) rename the file you are zapping to "@"
(c) delete the new file "@"

MS-DOS system calls exist to delete and rename files.  Please
double-check to make sure that the above does completely eradicate the
filename from disk.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi



More information about the Comp.lang.c mailing list