CSimpleStringT::Truncate

Truncates the string to the new length.

void Truncate(
   int nNewLength 
);

Parameters

  • nNewLength
    The new length of the string.

Remarks

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

Note

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

Example

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);

Requirements

Header: atlsimpstr.h

See Also

Reference

CSimpleStringT Class