I have the following line in my program that causes a run-time warning:
if (!is_directory("C:\\NGFMS_Debug\\Files") && !create_directories("C:\\NGFMS_Debug\\Files"))
The text of the warning is as so: "A buffer overrun has occurred in XXX.exe which has corrupted the program's internal state."
The warning comes in the call to "is_directory(...)". I'm guessing the space for the string isn't getting allocated, but I thought syntax like this was legal.
The is_directory function is a part of boost/filesystem.hpp and I am using the following namespaces:
using namespace boost;
using namespace boost::filesystem;
using namespace std;
This is getting compiled under VS2005 C++. Any ideas?
Update
I tried a couple different things and stepped through the code and here is what I found.
If I do this
char* path_chars_c;
path_chars_c = "C:\\Debug\\Files";
string path_str_c(path_chars_c);
The variable path_chars_c contains the appropriate string, but the variable path_str_c contains garbage after initialization. So it appears that the string initialization is broken here. Has anyone ever seen this?