nimaaa
Newbie level 6
- Joined
- Jul 25, 2014
- Messages
- 14
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Location
- Tehran, Iran, Iran
- Activity points
- 122
Hi
I have the string below and I want to extract the credit from it .
"+CUSD: 0,Credit: 16122 Rial"
Here is my code :
I checked it in DEV C++ , and it works correctly (I got 16122) .
but when I program it to the microcontroller ( using Codevison AVR ), the output result is always 0 ( I display it on a LCD ) .
Please help me to solve this proplem.
Thanks In Advance
I have the string below and I want to extract the credit from it .
"+CUSD: 0,Credit: 16122 Rial"
Here is my code :
Code:
#include <stdio.h>
int useless_value = 0 , credit_value = 0 ,scan = 0 ;
char response[27] = "+CUSD: 0,Credit: 16122 Rial"
void main(void)
{
scan = sscanf(response,"%*[^0123456789]%d%*[^0123456789]%d",&useless_value,&credit_value);
printf("%d%d",useless_value,credit_value);
sprintf(LCD_buffer,"%d",credit_value);
}
I checked it in DEV C++ , and it works correctly (I got 16122) .
but when I program it to the microcontroller ( using Codevison AVR ), the output result is always 0 ( I display it on a LCD ) .
Please help me to solve this proplem.
Thanks In Advance
Last edited: