ATL中CA2T乱码问题

This code:

Copy
LPCTSTR szr = CA2T(szReplaceFile);   
is equivalent to this:```


```cpp
LPCTSTR szr;
{
   CA2T temp(szReplaceFile);
   szr = temp.operator LPTSTR();
}   

As the memory allocated by the temporary object and returned from the cast operator is destroyed when the temporary object is destroyed, using the value in szr will have undesirable results.

Instead, use this code:

CA2T szr(szReplaceFile);   

The cast operator makes the CA2T object look like a LPCTSTR.

上一篇:【CF1425H】Huge Boxes of Animal Toys 题解


下一篇:Linux 操作系统原理 — 内存 — 大页内存