I have a very simple class stub – i just started making it:
class CJSScript
{
public:
CJSScript(std::string scriptfile);
~CJSScript(void);
private:
std::string scriptname;
};
CJSScript::CJSScript(std::string scriptfile)
{
size_t found = scriptfile.find_last_of("/\\");
scriptname = scriptfile.substr(found+1);
printf("should load %s now...", scriptname);
}
however in that constructor i get an exception, this apparently is set to 0x7ffffffe
main program is
int _tmain(int argc, _TCHAR* argv[])
{
CJSScript* test=new CJSScript("./script/test.js");
system("pause");
return 0;
}
what the hell is going on. i thought i had basics behind me a long time ago but this is a compromitation. of me or the compiler 🙂
debugger dump :
Win32Project3.exe!_output_l(_iobuf * stream, const char * format, localeinfo_struct * plocinfo, char * argptr) Line 1649 C++
Win32Project3.exe!printf(const char * format, ...) Line 62 C
Win32Project3.exe!CJSScript::CJSScript(std::basic_string<char,std::char_traits<char>,std::allocator<char> > scriptfile) Line 11 C++
Win32Project3.exe!wmain(int argc, wchar_t * * argv) Line 38 C++
Win32Project3.exe!__tmainCRTStartup() Line 240 C
printfdoesn’t know how to deal withstringobjects. You need to pass aconst char*:This is an issue of type safety. For this reason, among others, I prefer using streams.