C - wcstok在运行时崩溃

时间:2015-10-29 23:13:13

标签: c pointers winapi

这是我的代码:

#include <Windows.h>

void Example()
{
  wchar_t Src[MAX_PATH];
  GetModuleFileNameW(0, Src, sizeof(Src));
  MessageBoxA(0, "IN", 0, 0);
  wchar_t *Dst = wcstok(Src, L"\\"); // Crashes here, at run-time!
  MessageBoxW(0, Dst, __T("Out"), 0);
}

int main(int argc, char *argv[])
{
  Example();
  return 0;
}

在运行时,此应用程序在第8行崩溃。问题是为什么?

wcstok() reference

GetModuleFileNameW()

上的MSDN

0 个答案:

没有答案
相关问题