TempStr
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Deprecated Framework library function that creates a temporary XLOPER containing an xltypeStr byte string. It takes a null-terminated source string as input. It tries to overwrite the first character of the supplied string with the subsequent string's length. This is not always a safe thing to do: Microsoft Office Excel might crash if passed a read-only string.
LPXLOPER TempStr(LPSTR str);
Parameters
str
A pointer to the null-terminated source string. TempStr truncates strings that are longer than 255 bytes.
Return Value
Returns an xltypeStr string containing a pointer to the passed-in string buffer.
Remarks
This way of creating temporary strings is now deprecated in favor of the way in which both TempStrConst and TempStr12 work. These functions allocate a new memory buffer and copy the passed-in string into it. The input strings for TempStrConst and TempStr12 are not altered and so are declared as const. In contrast, the input string to TempStr is altered and so cannot be declared as const. The first character of the input string is treated as space for a length character and is overwritten by this function.