开发者

unexpected change of wchar variable

开发者 https://www.devze.com 2023-01-20 17:19 出处:网络
Okey this is driving me crazy now... I\'m working on a directX game in c++ and I got a global wchar variable called FpsString witch i declared like this:

Okey this is driving me crazy now...

I'm working on a directX game in c++ and I got a global wchar variable called FpsString witch i declared like this:

WCHAR * FpsString;

And in my initialization code i initialized it like this:

WCHAR a[100];  
FpsString = a;

Okay, here is the prob... FpsString suddenly changes to some Japanese (no offense) letters every time I enter the Rende开发者_开发百科r loop

Did I declare it wrong or what?


Is WCHAR a[100]; also global (static) or is it perhaps a local variable?

If it's local then that's your problem: It stops to exist when the scope (function) is complete.
Change it to FpsString = new WCHAR[100];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号