In manner to use DeleteFile
you must #include <Windows.h>
since it Win API function.
The argument must be a char*
pointer, std::string
can't be used as argument.
so you can do as follows:
std::string path = "\\path\\to\\dir\\";
std::string filename = path + "filemaker\\start.ini"; (when path does end with "\\")
DWORD res = DeleteFile(filename.c_str());
You can as well #include <stdio.h>
(or <cstdio>
) and use
int remove(const char* filename)
,
it is better since it is cross platform (ANSI C).
like this:
std::string path = "\\path\\to\\dir\\";
std::string filename = path + "filemaker\\start.ini"; (when path does end with "\\")
int res = remove(filename.c_str());
EDIT
You need also to add marshaling, like this:
//includes
#include <msclr\marshal.h>
#include <msclr\marshal_cppstd.h>
now the code:
String^ filepath=path+"filemaker\\start.ini";
const char* tmpptr= msclr::interop::marshal_as<const char*>(filepath);
DeleteFile(tmpptr);