Right I'm that close I can almost touch it.
To get all of the characters from szTempVIEWSTATE into my char data array I did the following:
strcpy(data, szTempVIEWSTATE);
I know this has worked as I can print out characters from the array now so I have the ability to extract the characters one at a time which is brilliant.
So, here comes the next part. What I planned to do was to have a variable which was:
char *szVIEWSTATE
And then what I would do is take every character one at a time from my char data array, check if it was a certain character and if it was append its conversion to szVIEWSTATE, if not I'd append the current value. I'm getting an error now but I'm 99% certain its because I'm not using the strcat incorrectly (i.e. its a middleware error which seems to occur when i've done some wrong coding). Could you please take a look at my code and tell me what i'm doing wrong. I'm sure I am starting to see a light at the end of the tunnel.
Code:
szLength = strlen(szTempVIEWSTATE);
printf("The length is: %d", szLength);
free(szTempVIEWSTATE);
szVIEWSTATE = (char *)malloc(20000);
memset(szVIEWSTATE, 0, 20000);
for(i=0; i<szLength; i++)
{
if(data[i] = "+")
{
strcat(szVIEWSTATE, "%2B");
}
else if(data[i] = "=")
{
strcat(szVIEWSTATE, "%3D");
}
else if(data[i] = " ")
{
break;
}
else
{
strcat(szVIEWSTATE, data[i]);
}
i++;
}