How to delete DETS file?

490 Views Asked by At

I'm having problem with DETS file, I cannot find functionality how to complete delete DETS file from my drive. Let's demonstrate scenario, you create DETS file insert one element and then you want to destroy that file as temporary but persistent storage.

dets:open_file("TestFile",[{file, "TestFile.db"}]).
{ok,"TestFile"}
dets:insert("TestFile", {a,b,c}).
ok
dets:delete_all_objects("TestFile").
ok
dets:info("TestFile").
[{type,set},
{keypos,1},
{size,0},
{file_size,5432},
{filename,"TestFile.db"}]

How can I delete file "TestFile.db" ?

1

There are 1 best solutions below

0
On BEST ANSWER

There's no function in the dets module for deleting the file itself. Just call file:delete("TestFile.db").