AfxIsValidString 

BOOL AfxIsValidString( LPCSTR lpsz, int nLength = -1 );

Return Value

Nonzero if the specified pointer points to a string of the specified size; otherwise 0.

Parameters

lpsz

The pointer to test.

nLength

Specifies the length of the string to be tested, in bytes. A value of –1 indicates that the string will be null-terminated.

Remarks

Use this function to determine whether a pointer to a string is valid.

See Also   AfxIsMemoryBlock, AfxIsValidAddress