Hi ayaka,
ayaka wrote,
Hi
I meet a problem with sscanf(), I want to use this function to parse
string into number. But I found the neither uint16_t nor uint8_t could work
with %d. Here is the sample code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main(int argc, char **argv)
{
uint8_t num1;
uint16_t num2;
uint32_t num3;
sscanf("10", "%d", &num1);
sscanf("10", "%d", &num2);
sscanf("10", "%d", &num3);
printf("input number is %d %d %d\n", num1, num2, num3);
return 0;
}
input number is 0 0 10
But if it is built with glibc at x86_64, the result would be:
input number is 0 10 10
I have no idea why the uint8_t doesn't work, but why the uint16_t doesn't
work?
Here is the config of uclibc, from openwrt
# Version: 0.9.33.2
That is really old. Could you please retry with uClibc-ng 1.0.15?
I have an update for LEDE in my queue, but I first want to add a
missing feature before submitting.
uClibc 0.9.33.2 is unmaintained.
best regards
Waldemar