Arank:
It will only work it fixed lengths? I tried with "%7s" and it works.
sscanf() is not a tokenizer function.
As any character (except the null character) is valid for a string, %s will take the whole string if there is no length limit, including digits and equals sign. And if you want to use a length limit, the limit must be correct like "%15s" for a 15 character string or "%7s" for a seven character string.
If you want to tokenize your string while not knowing about string lengths, you'd better use strtok() for seperating the different parts of the string.
As any character (except the null character) is valid for a string, %s will take the whole string if there is no length limit, including digits and equals sign. And if you want to use a length limit, the limit must be correct like "%15s" for a 15 character string or "%7s" for a seven character string.
If you want to tokenize your string while not knowing about string lengths, you'd better use strtok() for seperating the different parts of the string.
Hmm, Ok thanks jurs, I'm already using strtok(), I tought sscanf() should be easier.
christop:
You could try something like %15[^=] to read a string up to but not including the equal sign.
Thanks christop, your suggestion works like a charm!!
Delta_G:
There are very few things from regular C++ that got cut out of Arduino due to memory limitations. One of those things is variable length formatters. They just aren't supported.
Thanks for you answer Delta_G, but christop suggestion works.