0

Does anyone know , how to do the conversion from Ascii to long double?
Please provide one example.

Many Thanks.

4
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by Nick Evan
0

I'm unsure what you mean... do you want something like atof()? It's a C function that does the conversion. If you want C++, you'll have to use std.atof() or stringstreams.

Here's a code example:

char c_number[] = "45.33";
double d_number = atof(c_number);

And with stringstreams:

std::stringstream s_number("45.33");
double d_number;
s_number >> d_number;

Hope this helps

0

thanks for your answer.
i wanted to know, do we have any conversion function in C to convert ascii to long double as the same way we do for atof()?

0

thanks for your answer.
i wanted to know, do we have any conversion function in C to convert ascii to long double as the same way we do for atof()?

You've already been shown how to do it in both C and C++ - whats wrong with those methods?

0

thanks for your answer.
i wanted to know, do we have any conversion function in C to convert ascii to long double as the same way we do for atof()?

Use Joey's advice and just put the word 'long' in front of 'double'

Niek

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.