Number to String

From: Tony Burrows (
Date: 03/01/04

Date: Mon, 01 Mar 2004 16:15:31 +0000

It's easy using atoi etc to get numbers from strings. Are there any
functions which work the other way around, eg:

char aNumber[] = someFunc(3.14159);

or is the only way sprintf?


Relevant Pages

  • Re: Number to String
    ... As far as I know sprintf is the only way, it's really easy all you have to ... > It's easy using atoi etc to get numbers from strings. ...
  • Re: buffer interface problem
    ... The atoi function was coming from the locale library. ... I changed it to int and now it works. ... The last line is a problem, giving me this message: Type str doesn't support the buffer API ... either Unicode strings or bytestrings, ...
  • Re: [patch v2] epoll use a single inode ...
    ... wait a very clever idea to suppress individual dentry per pipe/sockets (no more sprintf() at pipe/socket setup) ... Yes, the right thing to do is probably to only generate these strings when someone tries to list them, not on every socket/pipe/epoll creation. ...
  • Re: Benchmarks: STLs string vs. C string
    ... without any extra strlen execution inside the sprintf. ... implementations, although all implementations I have tried have been very fast. ... In many programs you need to copy/format strings without actually doing a printf. ... I have noticed that most programmers dont care or know about the ...
  • Re: buffer interface problem
    ... I get the message "expected an object with the buffer ... either Unicode strings or bytestrings, ... The error is being raised by the atoi() function (in the future, ... The built-in int() function* can convert strings to ...