How to convert ULONG64 to PCSTR?
<p>I am quite new to C++, because I normally use C#. </p>

<p>Here is the code I am currently using (although I have tried plenty of other things):</p>

<pre><code>template &lt;class T&gt;
inline PCSTR to_string (const T&amp; t)
{
std::stringstream ss;
ss &lt;&lt; t;
return ss.str().c_str();
}



ULONG bugCheckCode = 0;
ULONG64 bugCheckArgs[4] = {0};
Control-&gt;ReadBugCheckData(&amp;bugCheckCode, &amp;bugCheckArgs[0], &amp;bugCheckArgs[1], &amp;bugCheckArgs[2], &amp;bugCheckArgs[3]);

CHAR arg2[sizeof(bugCheckArgs[1])];
ZeroMemory(arg2, sizeof(bugCheckArgs[1]));

memcpy(arg2, &amp;bugCheckArgs[1], sizeof(bugCheckArgs[1]));

Control-&gt;CallExtension(NULL, "function", arg2);
</code></pre>

<p>Basically, ReadBugCheckData returns a PULONG64, which I give an address to a ULONG64. I am pretty sure that this bit is alright, but since I am new to all this memory stuff, I shall post it just in case the mistake lies here. </p>

<p>So I now have a ULONG64 (typedef unsigned long long ULONG64) which I need to convert to a PCSTR (typedef CONST CHAR *PCSTR), which, if I understand correctly, is a char array??? So I tried the to_string function posted at the top of the code snippet, and I tried memcpy, but I can't get it to work. </p>

<p>But all I can get is nothingness or junk data. I am finding this particularly difficult to debug because this is an extension, and I can't step through the code properly. </p>

<p>Any ideas on how to do this conversion?</p>

<p>Thanks a lot.</p>
