请问,有人可以解释一下为什么这段代码在运行时"expression _block_type_is_valid(phead-nblockuse)"中给出了错误?
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <shlobj.h>
#include <iostream>
using namespace std;
int main() {
PWSTR path;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_Desktop, 0, NULL, &path);
delete[] path;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
因为内存不是由分配的new.事实上,如果你阅读文档,你会看到:
一旦调用不再需要,调用进程负责释放该资源
CoTaskMemFree.
| 归档时间: |
|
| 查看次数: |
314 次 |
| 最近记录: |