MANAGE c++ System::Convert::ToDouble with TCHAR ARRAY

Linh Huynh 96 Reputation points
2021-02-01T14:23:42.83+00:00

Hi,
I try convert TCHAR tcValues to double using the function below.

I use Manage C ++:

TCHAR tcValue[100] ;

//assume that tcValue = "0.1234" ;

                dblValue = System::Convert::ToDouble (tcValue) ;  // I always got dblValue = 1.0 for any value in tcValue
                dblValue = System::Convert::ToDouble (gcnew String(tcValue)) ; //I got correct value store in tcValue

My question is why this function (System::Convert::ToDouble (tcValue))
does not generate any error but does not return correct value stored in tcValue

Is this a bug in this System::Convert::ToDouble function?

Thanks

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,787 questions
{count} votes

Accepted answer
  1. Linh Huynh 96 Reputation points
    2021-02-01T18:05:51.477+00:00

    I confirmed that this is a MS bug with .NET Framework 4.0.

    I checked my old version and I did have the same code but with .NET Framework 1.1 and it is working correctly.

    Thanks


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.