Partager via


Using Strsafe.h (Windows CE 5.0)

Send Feedback

Developing an Application > Safe String Functions

To use the Strsafe functions inline, include the header file as shown here.

#include <strsafe.h>

Important   The include line for strsafe.h should follow all other headers' include lines.

To use the functions in library form, define STRSAFE_LIB before including the new header file, as shown below, and then add a link in your project to $(SDK_LIB_PATH)\strsafe.lib.

#define STRSAFE_LIB
#include <strsafe.h>

Note   StringCbGets, StringCbGetsEx, StringCchGets, and StringCchGetsEx must be run as inline functions.

When you include Strsafe.h in your file, the older functions replaced by the Strsafe.h functions are deprecated.

Attempts to use these older functions result in a compiler error telling you to use the newer functions. To override this behavior, include the following line in your code before including the Strsafe header file.

#define STRSAFE_NO_DEPRECATE

To allow only character count functions, include the following line in your code before including the Strsafe header file.

#define STRSAFE_NO_CB_FUNCTIONS

To allow only byte count functions, include the following line in your code before including the Strsafe header file.

#define STRSAFE_NO_CCH_FUNCTIONS

Note   You can define STRSAFE_NO_CB_FUNCTIONS or STRSAFE_NO_CCH_FUNCTIONS, but not both.

The maximum supported string length is 2,147,483,647 (STRSAFE_MAX_CCH) characters, either ANSI or Unicode.

See Also

StrSafe.h Character-Count Functions | StrSafe.h Byte-Count Functions

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.