Re: String to Octal



fuch6921@xxxxxxxxxxxxx writes:

I want to read in an Octal number argument and have it stored as an
octal number. For instance the user will type: ./a.out 777 and it
will store the octal number 777. But it atoi does this as an interger,
and sscanf gives me 0.

Use strtol(), specifying base 8.
--
"I've been on the wagon now for more than a decade. Not a single goto
in all that time. I just don't need them any more. I don't even use
break or continue now, except on social occasions of course. And I
don't get carried away." --Richard Heathfield
.



Relevant Pages

  • Re: String to Octal
    ... will store the octal number 777. ... But it atoi does this as an interger, ... If you lie to the compiler, it will get its revenge. ... -- Henry Spencer ...
    (comp.lang.c)
  • String to Octal
    ... will store the octal number 777. ... But it atoi does this as an interger, ... and sscanf gives me 0. ...
    (comp.lang.c)
  • Re: String to Octal
    ... will store the octal number 777. ... But it atoi does this as an interger, ... and sscanf gives me 0. ...
    (comp.lang.c)