Re: how to pass float value from argv?



On May 10, 5:34 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
Sunny said:

<snip>

It would be better to try not to use atoi()/atof().

Agreed.

If you read
the C manual. It clearly says that both atoi() and atof() has been
deprecated by strtol() and strtod()

Which C manual? If you mean the Standard, C&V please. If you mean
the man pages, mine don't say any such thing.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

I was referring to the man pages on my MacOS. However I checked the
man pages on Ubuntu and it doesn't say so. The man pages on Ubuntu
only says that both atoi() and atof() are the same as strtol() and
strtof(). The only difference is that atoi()/atof() does not detect
errors.
Sorry for the confusion.

Best,
Sunny
.



Relevant Pages

  • Re: how to pass float value from argv?
    ... It clearly says that both atoi() and atof() has been ... deprecated by strtol() and strtod() ...
    (comp.lang.c)
  • Re: how to pass float value from argv?
    ... The man pages on Ubuntu ... only says that both atoiand atof() are the same as strtoland ... My version of strtol() doesn't detect errors either. ... It's actually glibc on Linux. ...
    (comp.lang.c)
  • Re: how to pass float value from argv?
    ... The man pages on Ubuntu ... only says that both atoi() and atof() are the same as strtoland ... My version of strtol() doesn't detect errors either. ...
    (comp.lang.c)
  • Re: Check all errors in code?
    ... The atoi function converts the initial portion of the string ... pointed to by nptr to int representation. ... The atoi function returns the converted value. ... The strtol function returns the converted value, ...
    (comp.lang.c)
  • Re: question
    ... strtod is capable of telling you about errors. ... Use that capability. ... I am just used to using atoi. ... I'll check out strtol. ...
    (comp.lang.c)