How do I convert a System::IO::Stream^ to an LPCSTR for PlaySound?

Posted by Jon Cage on Stack Overflow See other posts from Stack Overflow or by Jon Cage
Published on 2010-06-15T12:53:03Z Indexed on 2010/06/15 13:02 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

I'm trying to embed and then play back a .wav file in a C++/CLI app but all the examples I've seen which use PlaySound are in VB. I can't see how to get froma Stream^ to the LPCSTR which PlaySound requires:

System::IO::Stream^ s = Assembly::GetExecutingAssembly()->GetManifestResourceStream ("Ping.wav");

LPCSTR buf = s->????;

PlaySound(buf, NULL, SND_ASYNC|SND_MEMORY|SND_NOWAIT);

I guess I need some sort of horrible .net memory conversion magic.

© Stack Overflow or respective owner

Related posts about conversion

Related posts about c++-cli