int GetResponseParameter(const char* lpszResponse, const char* lpszParamName, char* lpszBuffer, int nBufferLength){ memset((void*)lpszBuffer, '\0', sizeof(char) * nBufferLength); char* lpszParamNameLoc = strstr(lpszResponse, lpszParamName); char* lpszAmpLoc = NULL; // location of the trailing ampersand int nLength; if ( lpszParamNameLoc ) { // check to see if the parameter name is followed by an equals symbol. if it is // then we can be fairly certain that this is the parameter that were after. if ( *(lpszParamNameLoc + strlen(lpszParamName)) == '=' ) { // move the parameter name pointer to beyond the equals symbol that follows // the parameter name lpszParamNameLoc += strlen(lpszParamName) + 1; // get the location of the end of the parameters value lpszAmpLoc = strstr(lpszParamNameLoc, "&"); if ( lpszAmpLoc ) nLength = lpszAmpLoc - lpszParamNameLoc; else nLength = strlen(lpszResponse) - (lpszParamNameLoc - lpszResponse); // couldn't find an ampersand after the parameter name. this means // that it's the last value // we have the location of the ampersand. get all the text between the pointers strncpy(lpszBuffer, lpszParamNameLoc, nLength); return 0; } } else return 1; // unable to find parameter name } //