Hi All!
I need to split string for command and its value.
If i have "imax 1000" i need to get com = "imax", val = "1000".
Code:
void parse_command(char *str)
{
     char *chr;
     bool is_val = false;
     char *com;
     char *val;
     
     chr = str;
     
     while(*chr)
     {
        if(*chr != '\n' && *chr != '\0' && *chr != 32 /*space*/)
        {
             if(!is_arg)
             {
                 strcat(com, chr);
             }
             else
             {
                 strcat(val, chr);
             }
           
        }
        if(*chr == 32)
        {
            is_arg = true;    
        }
        chr++;
     }
         printf("%s",com); 
         printf("%s",val); 
}
It compiles ok but in run time programm stops responding.
P.S. It can be more then one spase between two strings.