Sign in to follow this  
Garlin

Untitled

Recommended Posts

Hey Guys Perhaps someone can help me. My app is running fine in Debug mode but in Release it seems as though any sprintf_s/wsprintf_s functions are not working. The buffers are all allocated properly, but sprintf is coping rubbish data into the buffer. Any ideas? I'm using VS2005. Code is nothing complex... char test[256]; memset(test, 0, 256); sprintf_s(test, "%s testtext", "text"); 'test' after that is rubbish. It also seems as though it has something to to with optimizations. If I disable optimizations or change it to Minimize Size then it seems to work. But it doesn't work all the time. What could be going wrong there?

Share this post


Link to post
Share on other sites
How do you "check" your buffer. Do you actually output the buffer using cout, or set a breakpoint and check the value.
I suppose you're doing the latter, wich will always result in garbage. You can use breakpoints in a release build, but you won't be able to really debug your application, only in debug builds.

Share this post


Link to post
Share on other sites
I've even used a message box. The data is defiantly ribbish.

Lets use the other thread with the correct title.

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this