Breaking apart a web form return

I am a new programmer and having a hard time wrapping my head around Parsing a String into the needed components. Using multiple Example programs I have gotten a web server running with a Page that has a Form on it where the User can input some IP information.

I have done it in two different forms not sure that one is better than the other.

One returns ip=192.168.1.253&subnet=255.255.255.0&gateway=192.168.1.1

The other Returns oct1=192&oct2=168&oct3=1&oct4=253&oct5=255 and so on

I need to break either one of these down into individual "int" that I have declared as oct1 and so on

I would appreciate any help on how to parse out the Integers

Thanks in advance

Robert

I would appreciate any help on how to parse out the Integers

Start by looking at strtok() and atoi()

I am a new programmer and having a hard time wrapping my head around Parsing a String

Are You Parsing a String Or A string? Why are there capital letters in the middle of your question?

I need to break either one of these down into individual "int" that I have declared as oct1 and so on

You may need to give a little more explanation as to just what in what is returned you want to extract and use. Are the "one of these" the components of the IP address?

So a little more Explanation of what I am doing is in order.

PaulS: Are You Parsing a String Or A string? Why are there capital letters in the middle of your question?

I have a very bad habit of Capitalizing random words when typing. It has caused me many headaches during the coding process. 90% of my debugging is fixing capitalization issues.

So what I have been working on is a way for the IP address of the arduino to be changed without getting into the IDE. I have it working except for the fact that I can't figure out the parsing of the returned address.

so when the form is completed with the IP information it returns

192.168.1.253/update/IP=192.168.10.101&subnet=255.255.255.0&gateway=192.168.10.1

or

192.168.1.253/update/oct1=192&oct2=168&oct3=10&oct3=101&oct5=255& so on

In my code I have declared

int oct1; int oct2; int oct3; int oct4; (also can I declare multiple Oct# in one line)

and so on.

I have set defaults as such

oct1 = 192; oct2 = 168; oct3 = 1; oct4 = 253

and so one

I need to get the new values from the string and put them in their appropriate variables

Have a look at this and adapt it to your needs

char returned[] = "192.168.1.253/update/IP=192.168.10.101&subnet=255.255.255.0&gateway=192.168.10.1";
byte oct[4];

void setup() 
{
  Serial.begin(115200);
  char * buffer = strtok(returned, "/");
  Serial.println(buffer);

  oct[0] = atoi(strtok(buffer, "."));
  Serial.println(oct[0]);
  for (int i = 1; i < 4; i++)
  {
    oct[i] = atoi(strtok(NULL, "."));
    Serial.println(oct[i]);
  }
}

void loop() 
{
}