Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

problem with wide char string

This topic is 2705 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HANDLE pSnapList;
PROCESSENTRY32 p32Info;
BOOL p32Status;

pSnapList = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
p32Info.dwSize = sizeof( PROCESSENTRY32 );

p32Status = Process32First( pSnapList, &p32Info );
while( Process32Next( pSnapList, &p32Info ) )
{
if( !strcmp( p32Info.szExeFile, processName.c_str() ) )
{
processID = p32Info.th32ProcessID;
return;

}



};





error C2664: 'strcmp' : cannot convert parameter 1 from 'WCHAR [260]' to 'const char *'

i hav no idea how to compare these 2 strings of different types. Any advice is greatly appreciated!


Share this post


Link to post
Share on other sites
Advertisement
You need to convert from one string type to another before you can compare them. The easier conversion is to convert the char string to a wide char string. Use [font="monospace"]mbstowcs()[/font] to convert it. Then you can use a wide string compare.

Also, consider why you are using the two types of string format. You might also look at changing your compiler options to give you wide strings by default, or just call the wide string versions to begin with.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!