judico
asked on
Converting a String into double?
How is a String converted into double in Visual C++ .NET?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're trying to declare Le[ii] as a variable of type double, which won't work. You can just take the implicit conversion from double to int. Your code should be (assuming you've assigned actual strings into LeSTRING[]):
System::String *strd = LeSTRING[ ii ];
Le[ ii ] = System::Double::Parse(strd );
System::String *strd = LeSTRING[ ii ];
Le[ ii ] = System::Double::Parse(strd
ASKER
Thank you so much for the help. It works very well.
P.S. I increased the points -- let me know if there is any problem.
P.S. I increased the points -- let me know if there is any problem.
You're welcome. Thanks for the extra points.
ASKER
static String *LeSTRING[] = new String*[ 1000 ];
static int Le __gc[] = new int __gc[ 1000 ];
and then, in a loop I'm trying the code you posted above, the way I thought it should be applied in this case:
System::String *strd = LeSTRING[ ii ];
double Le[ ii ] = System::Double::Parse(strd
but I get the error messages:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2440: 'initializing' : cannot convert from 'double' to 'double []'
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2440: 'initializing' : cannot convert from 'double' to 'double []'