Export (0) Print
Expand All

CSimpleStringT::Truncate

Truncates the string to the new length.

void Truncate(
   int nNewLength 
);

nNewLength

The new length of the string.

Call this method to truncate the contents of the string to the new length.

Note Note

This does not affect the allocated length of the buffer. To decrease or increase the current buffer, see FreeExtra and Preallocate.

The following example demonstrates the use of CSimpleStringT::Truncate.

CSimpleString str(_T("abcdefghi"), pMgr);

_tprintf_s(_T("Allocated length: %d\n"), str.GetLength());
_tprintf_s(_T("Contents: %s\n"), str);

str.Truncate(4);
_tprintf_s(_T("Allocated length: %d\n"), str.GetLength());
_tprintf_s(_T("Contents: %s\n"), str);

Header: atlsimpstr.h

Show:
© 2015 Microsoft