Hi !
I've just installed code::block bundled with mingw.
To test the compiler/debugger tools, I've compiled this snippet :
#include <tchar.h>
#include <memory.h> // for memset
#include <string>
using namespace std;
const unsigned kuiConfigFileNameMaxLength = 128;
int _tmain(int argc, _TCHAR* argv[])
{
int iErr = 0;
char cConfigFileName [kuiConfigFileNameMaxLength];
memset( (void*)cConfigFileName , 0, kuiConfigFileNameMaxLength );
// Get input file name
if ( strlen( (const char *) argv[1] ) > kuiConfigFileNameMaxLength )
{
iErr = 1;
}
else
{
memcpy( (void*)cConfigFileName, (const void*)argv[1], strlen( (const char *) argv[1] ));
}
string strConfigFileName( (const char*)(cConfigFileName), strlen( (const char *)cConfigFileName) );
return iErr;
}
While debugging, the program crahses @ line :
if ( strlen( (const char *) argv[1] ) > kuiConfigFileNameMaxLength )
Here the debugger messages :
Program received signal SIGSEGV, Segmentation fault.
In std::string::c_str() const () ()
Program received signal SIGSEGV, Segmentation fault.
Still, this works perfectly when compiled with Visual Studio.
Any hints ?
Regards
Sylvain