Huang Qiang wrote:
>
> I am using RTL 2.2 now .
> I need atoi and sprintf function in my RT task, but failed.
>
> I test it by insert some code into RTL2.2 example frank .
>
> 1. include the stdlib.h
> 2. insert follow lines into thread_code
>
> /*==================================================*/
> char test_sprintf[16];
> int test_atoi;
>
> sprintf(test_sprintf, "%d", fifo);
> rtl_printf("test_sprintf is %s\n", test_sprintf);
>
Instead of:
> test_atoi = (int)atoi(test_sprintf);
Try:
test_atoi = atoi(test_sprintf);
Casting to int is not neccessary. 'atoi' means "Ascii TO Integer".
Therefore, its reason for existing is to get an ASCII string and
returning an int. Casting an int to an int is redundant.
- Cheers, Kal.
> rtl_printf("test_atoi =%d\n", test_atoi);
> /*==================================================*/
>
> 3. do make then insmod frank_module.o , but failed in
>
> frank_module.o: unresolved symbol __strtol_internal
>
> 4. so I did "ld -r -o mod.o frank_module.o -L/usr/lib -lc"
> then insmod mod.o , but failed , too .
>
> What's wrong , can someone point me.
>
> Thanks
>
>
> -- [EMAIL PROTECTED]
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/