Sep 6, 2013 at 12:19pm UTC
All works fine but "delete[] cmd;" crash the program;
I tryed to find explaination in Internet but there was nothing. Here is the code:
1 2 3 4 5 6 7
int _tmain(int argc, TCHAR* argv[])
{
LPCTSTR cmd = new TCHAR[10];
//some code
delete [] cmd;
return 0;
}
Last edited on Sep 6, 2013 at 12:19pm UTC
Sep 6, 2013 at 1:26pm UTC
In the Windows world, TCHAR is useful when it comes to determine between wchar_t /char_t.
Sep 6, 2013 at 2:11pm UTC
TCHAR doesn't determine between wchar_t/char because it can be either. It's ambiguous by definition which is why I hate it and repeatedly recommend people avoid using it.
Sep 6, 2013 at 2:52pm UTC
Well, I normally just tell people to stay away from Windows-isms but we all see how useful that is...
Last edited on Sep 6, 2013 at 2:52pm UTC