This question already has answers here:
Closed 5 years ago.
Determine size of dynamically allocated memory in C
(14个答案)
我有这个密码:
TCHAR *sRes;
sRes = (TCHAR *) calloc(16384, sizeof(TCHAR));
DWORD dwRes = sizeof(sRes);

dwRes总是8,当然tcslen(sRes)总是0。
我在找16384。

最佳答案

不支持获取用malloc或calloc分配的块大小的机制。如果您改为调用HeapAlloc,则可以在此后调用HeapSize

关于c - 确定TCHAR的calloc数组的长度(不是字符串长度),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5708253/

10-12 16:11