Hello,
I'm wondering if any one can help me retrieve a mobile phone number using sccanf()? (or any other method!)
So far I have used both sscanf(); and strncmp(); successfully in different routines throughout my program, however I'm stuck trying to extract a phone number!
The string held in the char buffer... (note: 2x digits in the number have been altered for privacy reasons)
$$+CMGR: "REC UNREAD","+61435464839","","12/10/08,20:33:34+44"$$TEST MESSAGE$$$$OK$$
The code I'm using to extract the phone number...
if (strncmp(GPRSbuffer, "$$+CMGR",7) == 0) {
if (sscanf(GPRSbuffer, "$$+CMGR: \"REC UNREAD\",\"+%ld\",\"\",\"", &number)>0){
pc.printf("made it");
pc.printf("\n\n%ld", number);
}
}
It does make it through the sccanf if statement (confirmed by the printf 'made it'), however the number (long int) returned by sscanf is
does anyone know what I'm doing wrong?? I've tried %lu %ld data types .. and I have confirmed that the data types are declared appropriately.
(forgive me if this is a newbie question, I'm merely a hobbyist with computer science and i've spent all of my research energy on this one so far)
Regards
- Sam
Hello,
I'm wondering if any one can help me retrieve a mobile phone number using sccanf()? (or any other method!)
So far I have used both sscanf(); and strncmp(); successfully in different routines throughout my program, however I'm stuck trying to extract a phone number!
The string held in the char buffer... (note: 2x digits in the number have been altered for privacy reasons)
The code I'm using to extract the phone number...
It does make it through the sccanf if statement (confirmed by the printf 'made it'), however the number (long int) returned by sscanf is
does anyone know what I'm doing wrong?? I've tried %lu %ld data types .. and I have confirmed that the data types are declared appropriately.
(forgive me if this is a newbie question, I'm merely a hobbyist with computer science and i've spent all of my research energy on this one so far)
Regards
- Sam