Quantcast
Channel: Parallel Computing in C++ and Native Code forum
Viewing all articles
Browse latest Browse all 856

from wstring to LPWCSTR

$
0
0

This code builds

bool sound::play(const std::wstring soundfile ){

	//converting BOOL to bool
	//After the double negation, the value is guaranteed to be 0 or 1; the original value might be any int value.
	//std::wstring TMP = s2ws( convert->toString( soundfile ) );
	return !!PlaySoundW(soundfile.c_str(), NULL, SND_ASYNC);
}

but has a runtime error that read:

POPUP MSG
~~~~~~~~~
Unhandled exception at 0x00007FF64AC71E13 in Sound.exe: 0xC0000005: Access violation reading location 0x0000000000000020.

When compiling it, I get these readings from the stack:

STACK
~~~~~~
> Sound.exe!std::_String_val<std::_Simple_types<wchar_t> >::_Myptr() Line 513 C++
  Sound.exe!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Inside(const wchar_t * _Ptr) Line 2258 C++
  Sound.exe!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::assign(const wchar_t * _Ptr, unsigned __int64 _Count) Line 1154 C++
  Sound.exe!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::assign(const wchar_t * _Ptr) Line 1170 C++
  Sound.exe!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::operator=(const wchar_t * _Ptr) Line 1015 C++
  Sound.exe!jme::sound::playIt(const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & s) Line 37 C++
  Sound.exe!wmain(int argc, wchar_t * * argv) Line 11 C++
  [External Code] 

However, this very code works using MinGW-64bit, what do I need to do to get it to work under VSE-2013?


Viewing all articles
Browse latest Browse all 856

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>