Jump to content

atoi(), strtod(), itoa(), itoa(), etc APIs issue, not working somehow


Recommended Posts

Hi,

FYI, I've posted the same thread in

Microsoft Software Products - Discussion & Support > Windows NT4/2000/2003 also! I was told to post it here too and hence the post!

Anyways, here is the problem:

I'm working in a product based company and the product is deployed on Windows 2000. Our product has been running at the customers site for quite a while now (say around 2-3 yrs). Suddenly we have started getting a lot of issues with atoi(), itoa(), atof(), atol(), strtod(), strtol(), itoa(), etc APIs. They dont work sometimes and sometimes they result in a crash. We have started replacing all these APIs with sscanf() & sprintf().

I want to know why this issue started happening suddenly.

Is it because of some windows update/patch that resulted in the crash?

Is it because of some hardware issue?

Please let me know as this issue has started happening at many of our customer places all over the world and we don't have a clue on this one huh.gif

Note: There is nothing wrong with the code as it's working perfectly on other Windows 2000 machines for quite a while now!

I've heard a lot about of good things about this forum and greatly appreciate your help!

Edit: some more info:

We are using VC++ 6.0

I know APIs don't break like that..but we have suddenly started getting the issues on these APIs.

For Eg:

We recently had a crash issue with the following code:

virtual void SetDataText(CString &strText, int intAdditionInfo) { m_fdata = atof((LPCSTR)strText);}

The same above piece of code was working for more than 2 yrs. Suddenly it has started crashing!!! We would get "Runtime Error" before the crash!

We fixed the issue by replacing atof with sscanf:

virtual void SetDataText(CString &strText, int intAdditionInfo) { sscanf((LPCSTR)strText, "%f", &m_fdata);}

After this there was no more crash! There have been reports of crash on these APIs at different parts of code where they are used!

Edited by Ujwal Rao
Link to comment
Share on other sites

  • 2 weeks later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...