Search code examples
winapiparsingtokendelimitertchar

parsing tchars using _tcstok_s in winapi


With the following code I get an error "Unhandled exception at 0x59be5d2e (msvcr100d.dll) in simpleWindow.exe: 0xC0000005: Access violation writing location 0x00e750f8."

TCHAR *string1 = _T("last.first");
TCHAR *delim = _T(".");
TCHAR *context;
TCHAR *name = _tcstok_s(string1, delim, &context);

This is just an example I'm using, ultimately I am trying to pull in a string from another class, but I wanted to get the parsing working first.


Solution

  • Change to:-

    TCHAR string1[] = _T("last.first");