atoi() check

Ishwar Rattan ishwar@pali.cps.cmich.edu
Wed Jan 28 23:02:00 GMT 2004



On Wed, 28 Jan 2004, Liguo Song wrote:

> Deshpande Bansidhar(IFIN DC AI) wrote:
>
> >Hi all
> >
> >I have following code.
> >I want to add error handler for atoi() function.
> >
> >E.g.
> >
> >char *ch;
> >int num;
> >
> >/*Read ch here*/
> >
> >Num = atoi(ch);
   ^
   n
and
atoi() returns error when it fails, take the time to trap it.

HTH
-ishwar



More information about the Gcc-help mailing list