scanf doesn't work

Khem Raj raj.khem@gmail.com
Mon Jun 22 20:55:00 GMT 2009


On Fri, Jun 19, 2009 at 6:33 AM, Leonitis<rubixqb@gmail.com> wrote:
>
> Thanks everyone for responding so fast!
>
> My toolchain setup is the standard arm-unknown-linux-gnu configuration:
> kernel headers version 2.6.29
> binutils version 2.19.1
> gcc 4.3.2
> glibc 2.9
> etc..
>
> My test code is:
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char** argv)
> {
>        float a;
>        int b;
>
>        printf("Input float: ");
>        scanf("%f", &a);
>        printf("Input is: %f\n", a);
>
>        printf("\nInput integer: ");
>        scanf("%d", &b);
>        printf("Input is: %d\n", b);
>
>        return 0;
> }
>
> My output is:
> Input float: -3.5
> Input is: 3.500000
>
> Input integer: -3
> Input is: -3
>
> I'm not too familiar with what the Linux headers are for, but the kernel
> version on the evaluation board is 2.6.20. Could that be the problem?

I dont suspect kernel versions to be a problem here.
Could you try compile/run it as a static binary? if you have not done so.
It could just be a misatch of libraries on your system Vs the libraries
you are using to develop/compile the testcase

Thanks

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list