First of all, your code arrived all garbled. It would help if you formated it before sending. Second, it seems that you are placing your formatting string and arguments list in the reverse order relative to you source string: Source string =3D "12,1.525,2.789" Formatting string =3D "%f,%f,%hhd" Arguments order: &theFloat1, &theFloat2, &theChar1 Luckily your formatting string and arguments order are compatible with each other, so this would not cause hard bugs. If you instead had your formatting string and arguments in the wrong order then serious bugs would be expected. Your source string has in this order: an int (12), a float (1.525) and another float (2.789). For this source string your formatting string and arguments should be in this order: "%hhd,%f,%f", &theChar1, &theFloat1, &theFloat2 Again, this error alone would not cause any crash, it should only load theFloat1 with 12.0, theFloat2 with 1.525 and theChar1 with 2, leaving the remaining string after the last period not parsed. I think the problem may be in the "%hhd". Are you sure that sscanf honors it? Check the library documentation to see if it doesn't understand it simply as an int. Try using an integer variable to receive the result in the sscanf and then assign it to the final destination char variable. You could check also the return value from sscanf, it returns how many values it assigned to destination variables. Best regards, Isaac Em 10/08/2013 00:21, Bob Blick escreveu: > Welcome to the Piclist. > It's a requirement to have a topic tag in the subject line, you must do > it, it is not automatically added! > Here is a reference: > http://mailman.mit.edu/mailman/listinfo/piclist > > I have taken the liberty of adding the [PIC] tag to your post. > > Best regards, Bob > > On Fri, Aug 9, 2013, at 06:14 PM, Mascalzone Latino wrote: >> I'm using a *Microchip C30 compiler* on *dsPIC33F family* and struggling >> A >> LOT with *sscanf() function*. Please please please help me because my >> project is getting stuck for this little detail. I really hope that >> someone >> can help me, I haven't found anything on internet and I spent the last 2 >> days on this issue. Thanks a lot in advance*THE TASK*I have to read >> different types of numbers from a string (unsigned int, float, char and >> unsigned char).*THE ISSUES*I have problems reading numeric char and >> unsigned >> char (i.e. 8 bit numbers, not ASCII characters), but not the other ones. >> With problem I mean that sscanf() fails (crashes) during its execution >> without returning any numeric value. In particular the problems come whe= n >> I >> try to read more than one char (or unsigned char) in a row. As a char >> conversion specifier I use %hhd, but I tried - at least I think - with >> all >> the possible combinations. For unsigned char I used %hhu.In order to >> understand better please look at this examples with just float and char. >> Float are read correctly, char just in case A) with one char >> parameter.*A) >> JUST ONE CHAR HAS TO BE READ: it works correctly*// 99 init values just >> for >> debugging resonschar string[] =3D "test1 12,1.525,2.789";char theChar1 = =3D >> 99;float theFloat1;float theFloat2;int retVal =3D 99;retVal =3D >> sscanf(&string[6],"%f,%f,%hhd",&theFloat1, &theFloat2, &theChar1);*B) TW= O >> CHARS HAVE TO BE READ: it doesn't work, sscanf() does not complete its >> execution and doesn't provide a return value*// 99 init values just for >> debugging resonschar string[] =3D "test1 12,1.525,2.789";char theChar1 = =3D >> 99; >> char theChar2 =3D 99;float theFloat1;float theFloat2;int retVal =3D 99;r= etVal >> =3D >> sscanf(&string[6],"%f,%f,%hhd,%hhd",&theFloat1, &theFloat2, &theChar1, >> &theChar2);*C) THREE CHARS HAVE TO BE READ: it doesn't work, sscanf() >> does >> not complete its execution and doesn't provide a return value*// 99 init >> values just for debugging resonschar string[] =3D "test1 >> 12,1.525,2.789";char >> theChar1 =3D 99; char theChar2 =3D 99;float theFloat1;float theFloat2;in= t >> retVal >> =3D 99;retVal =3D sscanf(&string[6],"%f,%f,%hhd,%hhd,%hhd",&theFloat1, >> &theFloat2, &theChar1, &theChar2, &theChar3);*THANKS SO MUCH FOR YOUR >> HELP!!!* --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .