Can someone tell me how can I delete the entire content of a .bin file?
Delete it and then write an empty one.
[I deleted the file with system("del ...") but i can't create a new one in his place with fstream file;file.open(...);
1 2 3 4 5
|
fstream wrtfile;
wrtfile.open("C:\\mycmd\\sysfiles\\var.bin",ios::binary|ios::trunc);
wrtfile<<readln;
wrtfile.close();
cout<<"Variable succesfully deleted";
|
Last edited on
You don't need to delete it before ios::trunc. It automatically erase it's contents.
Last edited on