How do I convert a LPVOID (void*) to string?

Nieto neto.ribeiro at email.com
Mon Oct 16 21:48:35 UTC 2017


How do I convert/create a D string from LPVOID (void*)?

> string GetLastErrorMessage() {
>
>	LPVOID lpMsgBuf;
>	DWORD errorMessageID = GetLastError();
>
>	FormatMessageA(
>		FORMAT_MESSAGE_ALLOCATE_BUFFER |
>		FORMAT_MESSAGE_FROM_SYSTEM |
>		FORMAT_MESSAGE_IGNORE_INSERTS,
>		NULL,
>		errorMessageID,
>		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
>		cast(LPSTR) &lpMsgBuf,
>		0, NULL);
>
>
>	return ??
>}


More information about the Digitalmars-d-learn mailing list