读书人

关于宽字符的有关问题

发布时间: 2012-02-08 19:52:21 作者: rapoo

关于宽字符的问题!
wchar_t *b = _T( "asdf ");
wchar_t *m_Path;
m_Path = (wchar_t *)malloc(_tcslen(b) + 1);
_tcscpy(m_Path,b);
free(m_Path);
这段程序走到free那就报错,宽字符不能这样释放???应该怎么做呢???

[解决办法]
malloc(sizeof(wchar_t) * (_tcslen(b) + 1));

读书人网 >C语言

热点推荐