There are standard functions such as atof and atoi in C’s stdlib.h for converting strings to floats / integers (and to do the reverse too). Is there an equivalent of this in Tcl or do I need to write my own process for carrying out these tasks?
There are standard functions such as atof and atoi in C’s stdlib.h for converting
Share
Everything is a string in Tcl, but functions that expect a number (like
expr) will use that ‘string’ as an integer:If you want to format a number in a specific way (like producing a floating a point number of a specific precision) then you can use
format: