FIX: CFile::GetFileName() Always Returns CString w/Zero Length (143086)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
This article was previously published under Q143086 SYMPTOMS
If you call CFile::GetFileName(), it will return a CString with the correct
file name. However, if you call GetLength() on the CString, it will return
0.
CAUSE
The MFC function CFile::GetFileName() writes directly to the CString's
character pointer. However, it doesn't set the CString's size before
returning from this function.
RESOLUTION
Call CString::ReleaseBuffer() after calling CFile::GetFileName().
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products
listed at the beginning of this article. This bug was corrected in
Visual C++ 4.1.
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbBug kbFileIO kbfix kbNoUpdate kbString kbVC410fix KB143086 |
---|
|