Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int num;
|
||||
|
||||
sscanf("0123459", "%d", &num);
|
||||
printf("%d\n", num); /* prints 123459 */
|
||||
|
||||
sscanf("abcf123", "%x", &num);
|
||||
printf("%d\n", num); /* prints 180154659 */
|
||||
|
||||
sscanf("7651", "%o", &num);
|
||||
printf("%d\n", num); /* prints 4009 */
|
||||
|
||||
/* binary not supported */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int num;
|
||||
char *endptr;
|
||||
|
||||
num = strtol("123459", &endptr, 0);
|
||||
assert(*endptr == '\0');
|
||||
printf("%d\n", num); /* prints 123459 */
|
||||
|
||||
num = strtol("0xabcf123", &endptr, 0);
|
||||
assert(*endptr == '\0');
|
||||
printf("%d\n", num); /* prints 180154659 */
|
||||
|
||||
num = strtol("07651", &endptr, 0);
|
||||
assert(*endptr == '\0');
|
||||
printf("%d\n", num); /* prints 4009 */
|
||||
|
||||
/* binary not supported */
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue