Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5822 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

I want to view a "long" in the MessageBox Here is a simple version of what I am doing : long xyz = 4; char* ok; ok = (char*)xyz; MessageBox(NULL,ok,"",MB_OK); When I execute I get the system error saying : The instruction at 0x77e13e49......ref memory could not be read" Could someone help? My best regards

Share this post

Link to post
Share on other sites
looks like you''re trying to dereference a null pointer...
this right here is your problem:

long xyz = 4;
char* ok;
ok = (char*)xyz;

you cant'' "cast" a long to a character array. you''ll have to
convert it using a manual algorithm (or one that''s already availible).
i know there''s an atoi() and itoa() function, perhaps there is an
ltoa() function as well, i''m too lazy to look it up

anyway, that''s where the problem is at, im sure you can take it
from here.

;another space monkey;
[ Forced Evolution Studios ]


''In C we had to code our own bugs. In C++ we can inherit them.''

Share this post

Link to post
Share on other sites
For concatenating/embedding variable-format data with/in strings in C, please use snprintf. In C++, use std::stringstream.

Share this post

Link to post
Share on other sites

  • 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!