Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sscanf in pic32 programs
02-05-2014, 09:44 PM,
sscanf in pic32 programs
Hi all,
does anyone use sscanf c library function in his pinguino programs?
I tried to use it to retreive from a string 3 unsigned char values:
the string was "0 0 0" and i used
sscanf(data, "%hhu %hhu %hhu", a, b, c);
but the program hangs.
The only solution i found was to declare a, b, c as int instead of unsigned char and to modify the code as:
sscanf(data, "%d %d %d", a, b, c);
Anyone knows what are the implemented format specifiers in the included c library? Are the library sources available for recompilation?
Tanks in advance
03-05-2014, 11:27 AM,
RE: sscanf in pic32 programs
You'd need to pass &a, &b, &c
(if a,b,c are not pointers)

03-05-2014, 03:06 PM,
RE: sscanf in pic32 programs
(03-05-2014, 11:27 AM)pingotg Wrote: You'd need to pass &a, &b, &c
(if a,b,c are not pointers)


Thanks John,
The problem is that I passed the pointers! It was only a typing mistake in te post!
My code works only with integers, and not with other types!
03-05-2014, 06:03 PM,
RE: sscanf in pic32 programs
Much better to post actual code (a few lines, at least), preferably a small test app that anyone could run to see the problem.

BTW, you may want to check the C standard to see if using what I think you did is actually legal. If it's not (and it may well not be) then any outcome is allowed....

13-09-2015, 05:31 PM,
RE: sscanf in pic32 programs
sscanf is handy ... but me too, I didn't find it for PIC32 ...

you could try to use strtol(...); strtof(...) instead.

Forum Jump:

Users browsing this thread: 1 Guest(s)