[The CHString class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]
Each of these constructors initializes a new CHString object with the specified data.
throw(CHeap_Exception) CHString( LPCWSTR lpch, int nLength );
Pointer to an array of characters of length nLength.
Count of the number of characters in lpch.
Because the constructors copy the input data into new allocated storage, memory exceptions can result. Some of these constructors act as conversion functions; you can substitute, for example, an LPWSTR where a CHString object is expected.
Several forms of the constructor have special purposes:
Constructs a Unicode CHString string from an ANSI string.
Constructs a CHString string from a Unicode string.
CHString( const unsigned char*
Enables you to construct a CHString string from a pointer to unsigned char.
The following code example shows the use of CHString::CHString:
CHString s1; // Empty string CHString s2( L"cat" ); // From a C string literal CHString s3 = s2; // Copy constructor CHString s4( s2 + " " + s3 ); // From a string expression CHString s5( 'x' ); // s5 = "x" CHString s6( 'x', 6 ); // s6 = "xxxxxx" CHString city = L"Philadelphia"; // NOT the assignment operator
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008|
|Header||chstring.h (include FwCommon.h)|