Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

SafeStringCopy 

Call this function to copy a string into a fixed size character buffer.


template <class T>
inline bool SafeStringCopy(
      T& Destination,
   const char* Source 
) throw( );

Parameters

T

A fixed size character buffer of type char[Size] (not char*).

Destination

The buffer to which the data should be copied.

Source

The null-terminated string containing the data to be copied.

Returns TRUE if all of Source was copied to Destination, FALSE if the data was truncated.

The function is safe because it will not compile if type T is not a fixed size character buffer and if type T is a fixed size buffer, it guarantees not to copy more characters than the buffer is capable of holding. In addition, the destination buffer is always null-terminated on return from this function, even if the data was truncated.

Header: atlstencil.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.