Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have a string which captures details stored in data
data
User 6%, System 18%, IOW 0%, IRQ 0%
What i am doing is
sscanf(data,"User %d,System %d,IOW %d,IRQ %d",&user,&sys,&iow,&irq);
I am getting wrong output . why ? Is is like i am missing something ?
You left out the % symbols and some spaces - try:
%
sscanf(data,"User %d%%, System %d%%, IOW %d%%, IRQ %d%%",&user,&sys,&iow,&irq);
Add a comment
You have wrong output because you input string is like: User 6%, System 18%, IOW 0%, IRQ 0%
But you try to scan a string like: User 6, System 18, IOW 0, IRQ 0
User 6, System 18, IOW 0, IRQ 0
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.