I am trying to have a program delete a file using the DeleteFile function passing a string argument with a .c_str() conversion, but VS2010 keeps throwing a "error C2228: left of '.c_str' must have class/struct/union" error.
remove(String^.c_str()) gives the same error as well.
I've included sstream, and windows.h.
I can't seem to find an answer via Google, since nobody else seems to have this issue.
PS You could convert the System::String to a std::string and then use it with either DeleteFile() or remove(), but that's not really the way to go in C++/CLI code.
If you know your way around WinAPI calls and the C and C++ standard libraries, but not .NET, then google e.g. ".NET equivalent of DeleteFile" -- it gives me the page "File.Delete Method (System.IO) - MSDN - Microsoft" as the first hit. Note that a lot of the examples are in C# but it's pretty easy to convert basic C# into C++/CLI