I have created some binary file, I would like to delete that binary file by using C ++ program. I have been trying to figure out how to delete batch file but no idea about binary file. Any ideas?
I have created some binary file, I would like to delete that binary file by using C ++ program. I have been trying to figure out how to delete batch file but no idea about binary file. Any ideas?
To delete a file in C++ program follow this example :
std::remove("xyz.txt");
Which make the following changes :
#include <cstdio>
#include <cstdlib>
For the directory changes you need to understand the C++ directory manipulation in C++ library.
try:Code:#include <stdio.h> #include <string> binary file_delete(std::string filename) { if( _unlink( bin.c_str() ) != 0) { bin is name of binary file } return false; return true; }
Code:#include<iostream.h> #include<fstream.h> #include<stdio.h> #include "apstring.cpp" int main () { cout<<"Enter file which you want to delete "; getline(cin,fdel); if (remove(fdel.c_str( )) !=0) cout<<"Remove failed calculation"<<endl; else cout<<fdel<<" has been removed."<<endl; return 0; }
Bookmarks