Getting two minus numbers from an incoming serial string

Hello there, my first time on this forum which I have used for a long time (read only!)
I really am stuck and would like some help with this problem please.

The program looks for a minus sign, this is the beginning of the incoming
temperatures from Sim800 module (i.e.)" -9 -22 " or, " -10 -25 " or, " -23 -32 ". The temperature always starts with a minus sign.

I am trying to get two values from this that I can use to set the temperature on a Dallas DS1820 sensor. Please can someone show me how? I need to end up with two values (i.e) val1 = -9 and val2 = -22 which I can set by receiving a text with the values as above.

"Store_temperature() is my function to do this but I have no idea
how to go about this...

void Get_Temp(){
  
  sensors.setResolution(tempSensor, 9);
  sensors.requestTemperatures();                            // Set up Dallas thermometer 
  int T=(sensors.getTempCByIndex(0));                  // Read the Dallas sensor
  Temperature = (T);
  char buffer[5];
}      
void recSms(){
  number="";
  ESP.wdtFeed(); 
  if(Serial.available())
{ 
  char data = Serial.read();
  if(data == '+'){RcvdCheck = 1;}
  if((data == 'C') && (RcvdCheck == 1)){RcvdCheck = 2;}
  if((data == 'M') && (RcvdCheck == 2)){RcvdCheck = 3;} 
  if((data == 'T') && (RcvdCheck == 3)){RcvdCheck = 4;}
  if(RcvdCheck == 4){RcvdConf = 1; RcvdCheck = 0;}

  if(RcvdConf == 1)
{
  if(data == '\n'){RcvdEnd++;}
  if(RcvdEnd == 3){RcvdEnd = 0;}
  RcvdMsg[mydex] = data;
  mydex++;

  if(RcvdEnd == 2){RcvdConf = 0;MsgLength = mydex-2;mydex = 0;}
  if(RcvdConf == 0)
{
  for(int x = 4;x < 16;x++)
{
  number+=RcvdMsg[x];
  MsgMob[x-4] = RcvdMsg[x];
}    
  
  Serial.println();
        
 for(int x = 45; x < MsgLength; x++){

  MsgTxt[x-45] = RcvdMsg[x];
  inchar=MsgTxt[x-45];     
}        
         
  Serial.println();

  RcvdCheck = 0;
  RcvdConf = 0;
  mydex = 0;
  RcvdEnd   = 0;
  MsgMob[15]; 
  MsgTxt[50];
  MsgLength = 0;
 
  Serial.flush();
  Serial.println(inchar);
  
 if(inchar == '#'){     // If "#" is received at any time then reply with current temperature 
  sendInfo();       // do it !
  
  }else{  
    
 if(inchar == '*'){ 
  store_number();
  
  }else{  
/*-----------------------------------------------------------------------------------------------
 *  The program looks for a minus sign, this is the beginning of the temperatures(i.e.)" -9 -22 "
 *  or " -10 -25 " or " -23 -32 ". The temperature always starts with a minus sign
 *  I am trying to get two values from this that I can use to set the temperature 
 *  on a Dallas DS1820 sensor. Please can someone show me how? I need to end up with two                
 *  values (i.e) val1 = -9 and val2 = -22 which I can set by sending a text with these 
 *  values as above. "Store_temperature() is my function to do this but I have no idea 
 *  how to go about it.
 *-----------------------------------------------------------------------------------------------
 */    
 if(inchar == '-'){ 
 
  store_temperature();
  Serial.println(inchar);  
       }
      }    
     }
    }
   }
  }
 }
  
 void store_temperature(){
    
Serial.println("Storing temperatures");
Serial.println(inchar);

// I can print the inchar data "-9 -22" but how do I separate it now into the two values for processing ?

    
  }

I am trying to get two values from this that I can use to set the temperature on a Dallas DS1820 sensor.

That makes no sense. You do not set the temperature of a thermometer.

All those Serial.println() calls are just wasting time and FLASH space. Make them print something useful or GET RID OF THEM.

  MsgMob[15];
  MsgTxt[50];

Completely useless. GET RID OF THEM.

inchar is assigned a value on every iteration of the loop to copy the content of the text message. It is only used after the loop ends, so it contains only the last character of the message. The comments after the loop, about testing any character in the message are WRONG.

Gnasher:
The program looks for a minus sign, this is the beginning of the incoming
temperatures from Sim800 module (i.e.)" -9 -22 " or, " -10 -25 " or, " -23 -32 ". The temperature always starts with a minus sign.

Have you the ability to change the format in which the data is sent to the Arduino? If so I suggest you change it to "<-9-22>" and use the system in the 3rd example in Serial Input Basics to receive it.

If you can't change the format can you tell us if each message is followed by a linefeed or carriage-return character? If it is then you could use the system in my 2nd example to receive the data.

And if you look at the parse example you will see that it uses a comma as the separator between values. You can easily change that to a minus.

...R