Topic : sscanf calling __io_getchar()?

Forum : ARM

Original Post
Post Information Post
August 15, 2011 - 8:02pm
Guest

I have a project where I have written my own __io_getchar(). Elsewhere in the project, I need to use sscanf(buf, "0x%lld", &_ll);, where _ll is a long long and buf points to memory with a '1' followed by a null (I also tried putting "0x01" at *buf, same result). Finally, I am using small printf under the LD Linker/Libraries capability, because I want the ability to sprintf/printf floats.

When the call to sscanf is made, eventually my __io_getchar() routine is called, which makes no sense - sscanf should never read from the console, only from the buffer it is given. A bit of code inspection revealed that sscanf eventually calls into small_vfsscanf.c, which in turn does look like it can call __io_getchar(). Looking at the Small_libraries_documentation.pdf, I noted that it says:

Quote:
Note :Be careful when not using SMALL_SCANF , scanf will not work properly.

Any ideas why my __io_getchar() would be called by sscanf? Is it related to the warning from Small_libraries_documentation.pdf listed above? I need to use floats in sscanf, so i think using SMALL_SCANF isn't really an option...

Replies
Post Information Post
+1
0
-1
August 15, 2011 - 11:07pm
Guest

Never mind - turns out small scanf omits support for not only files, but buffers as well. I managed to build a custom version that includes the buffer support I need w/out requiring file support. The documentation could be a little more clear on what small_printf/small_scanf means.