Concept

How can you convert a string to a number using sscanf()?

ComputerScienceOne / Conversions

"We’ve previously examined the functions atoi() and atof() that allow you to convert strings that hold numeric values to int and double values respectively. Another way to convert strings to numbers is to use a function similar to the familiar scanf() function which reads its string from the standard input. The sscanf() function reads its “input” from a string instead of the standard input.\n\nchar s[] = \"103212.3214\";\n\ndouble x;\n\nsscanf(s, \"%lf\", &x);\n\n//x now has the value"

Related Ideas

How can you convert a string to a number using sscanf()? | ComputerScienceOne | Bifalgorithm | Bifalgorithm