[uClibc]scanf in mips arch.
ljw
ljw at ialink.com.tw
Wed May 8 09:44:14 UTC 2002
Hi all,
I noticed a problem while using my mips-uclibc-based
system. While I used ps, the PID of every process is
wrong but I look into /proc entry, the information there
is right.
So I do some small tests here.
int main(int argc, char **argv)
{
int a, b;
printf("Input a ==>");
scanf("%d", &a);
printf("a = %d\n", a);
}
The result,
# ./test_scanf
Input a ==>123
a = 23
#
Everytime I run the test, it kept ignoring the first digit of the number,
and if I only enter one-digit number it would behave strangely and
stoped. I looked into the ps.c in busybox and found sscanf is used
while extracting the PID from proc entry. So, I can see why the
showing pid of the processes in ps are 0(if the real PID is one-digit)
or lost the first digit of it.
What's wrong?
Thanks in advance.
Gary
More information about the uClibc
mailing list