This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/17111] STRTOL(3) unexpected behavior when use '`' before number (i.e."```1") as argument of main ()
- From: "sergey.churayev.76 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 05 Jul 2014 02:27:42 +0000
- Subject: [Bug libc/17111] STRTOL(3) unexpected behavior when use '`' before number (i.e."```1") as argument of main ()
- Auto-submitted: auto-generated
- References: <bug-17111-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17111
Sergey Churayev <sergey.churayev.76 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #6 from Sergey Churayev <sergey.churayev.76 at gmail dot com> ---
Ok,
The problem relates to transfer arguments in main (), not to strtol function.
But, how about this:
I have in my program this line
str = "0x0808"; And then try to convert it to long int.
Why I got this message?
strtol() returned 0
Further characters after number: x0808
According specification:
...
If base is zero or 16, the string may then include a "0x" prefix, and the
number will be read in base 16; otherwise, a zero base is taken as 10 (decimal)
unless the next character is '0', in which case it is taken as 8 (octal).
...
Best regards,
Serg.
--
You are receiving this mail because:
You are on the CC list for the bug.