Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

SmallC and sscanf

Hi folks-

In my NIOS2 project I started using sscanf() to parse text strings. The linker complains that sscanf is not found. Research tells me turn off the SmallC option on the nios2-elf-gcc command line (disable "-msmallc"). Looking at the properties of project, nios2-elf-gcc doesn't explicitly state the -msmallc option. So I conclude there must be another way to control the use of the SmallC library.

Can anyone tell me the right way to turn on link support for sscanf()?

Thanks, John.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Actually I would generally avoid using any of the scanf family of functions. They are very difficult to use properly - ie verifying all input and without leaving the code open to expliots.

    Use strtoul() and friends to parse numbers and str* (but not strtok) for stings.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It turns out exclusion or inclusion of the Small C library is controlled using a checkbox in the System Library Properties dialog box.

    JJS