milan.rajik
Banned
I have two string pointers.
I need to move the string "verification code" from buff2 to buff1. How to do that?
Edit:
//Usage
GSM_GPRS_Split(&temp, &gsmData, '\n', 2, '\r', 2);
Will this code work?
I need to copy data which appears between 2nd '\n' and '\r' which appears at the end of message.
*buff2 increments till 2nd '\n' is found then it starts copying data to *buff1 till it encounters 2nd '\r' from the beginning of message.
Is my code correct?
Code C - [expand] 1 2 unsigned char *buff2 = "Your Google verification code is 484537" unsigned char *buff1 = " ";
I need to move the string "verification code" from buff2 to buff1. How to do that?
Edit:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 unsigned char gsmData[] = "AT+CMGR=156\r\r\n+CMGR: \"REC READ\",\"p4w4w274\",,\"2013/01/02 19:16:19+22\"\r\nYour Google \r\nverification code is 484537;\r\n" unsigned char temp[160]; void GSM_GPRS_Split(char *buff1, char *buff2, char delimit1, unsigned int delimit1Count, char delimit2, unsigned int delimit2Count){ unsigned int delimit1Cnt = 0, delimit2Cnt = 0; while(delimit1Cnt != delimit1Count){ if(*buff2 == delimit1)delimit1Cnt++; *buff2++; } while(delimit2Cnt != delimit2Count){ if(*buff2 == delimit2)delimit2Cnt++; *buff1++ = *buff2++; } *buff1--; *buff1 = '\0'; }
//Usage
GSM_GPRS_Split(&temp, &gsmData, '\n', 2, '\r', 2);
Will this code work?
I need to copy data which appears between 2nd '\n' and '\r' which appears at the end of message.
*buff2 increments till 2nd '\n' is found then it starts copying data to *buff1 till it encounters 2nd '\r' from the beginning of message.
Is my code correct?
Last edited: