Help me with strncpy(solved)

I am trying to get strings out of the etherenet shield communicating with a webpage with some form fiels…

so i have this

          get_form=clientline+5; // i get the string from the form
          Serial.println(get_form);
          Serial.println("");
          strcpy(form_string,get_form);
          hours=strchr(form_string,'s');// i want to position in the first "s" of "hours"           
       
          
         strncpy(hour_form,hours,5);//Copy to hour_form in theory to extract 5 chars and get "s=123"(5 characters right?)

         
         Serial.print("extracted hours ");Serial.println(hour_form);
          Serial.println("");

but it is not doing that…

here is the print out:

form?hours=123&goal=233 HTTP/1.1

extracted hours s=123TTP/1.1

Solved

char buffer[]="GET /form?hours=12345&goal=789 HTTP/1.1";

char *get_form,*hours,*hoursF;
char form_string[50];
char hour_form[10];
char goal_form[10];
char temp_hour[15];
void setup() {    
Serial.begin(9600);  

          get_form=buffer+5;
          Serial.print("get Form : ");Serial.println(get_form);
          
          Serial.println("");
          
          strncat(form_string,get_form,30);
          //strcpy(form_string,get_form);
          Serial.print("copy to string  : ");Serial.println(form_string);
          hours=strchr(form_string,'s');// i want to position in the first "s" of "hours"           
          hoursF=strchr(hours,'&');
          
          strncpy(hour_form,hours+2,hoursF-hours-2);//Copy to hour_form in theory to extract 5 chars and get "s=123"(5 characters right?)
           Serial.print("extracted hours ");Serial.println(hour_form);
          Serial.println("");
          
          
          hours=strchr(form_string,'l');// i want to position in the first "s" of "hours"           
          hoursF=strchr(hours,' ');
          
          strncpy(goal_form,hours+2,hoursF-hours-2);
         
         Serial.print("extracted Goal ");Serial.println(goal_form);
         Serial.println("");






}


void loop() {
  
  
  
  
  
}

Print out:

get Form : form?hours=12345&goal=789 HTTP/1.1

copy to string  : form?hours=12345&goal=789 HTTP
extracted hours 12345

extracted Goal 789

"Snippets are Us" is down the road a ways. We need to see all of your code. Specifically, we need to see how the variables referenced in the snippet are defined.