Question

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" ?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top