Having a problem w/comparison of strings received from serial port`

I’m having problems working with strings received from a serial port. I am able to buffer and receive the data and print it via:

Serial2.println(data3);

and all looks good but when I try to do a comparison of the string I don’t get a match. The serial processing and data comparison functions look like:

void monitorCNC()
{
    Serial2.print("Serial2 Bytes Available: ");
    Serial2.println(Serial3.available());
    static char input_line [MAX_INPUT];
    static unsigned int input_pos = 0;

    while (Serial3.available () > 0) 
    {
    char inByte3 = Serial3.read();

      switch (inByte3)
      {

        case '\n':   // end of text
        input_line [input_pos] = 0;  // terminating null byte
        
        // terminator reached! process input_line here ...
        process_data (input_line);
        
        // reset buffer for next time
        input_pos = 0; 
        break;
  
      case '\r':   // discard carriage return
        break;
  
      default:
        // keep adding if not full ... allow for terminating null byte
        if (input_pos < (MAX_INPUT - 1))
          input_line [input_pos++] = inByte3;
        break;

      }  // end of switch
    }
}

// here to process incoming serial data after a terminator received
void process_data(char * data3)
{
  Serial2.print("Data3 Value: "); // debug info
  Serial2.println(data3); // debug info, this prints the expected string of "Grbl 0.9a ['

Serial2 is my debug monitor and I am reading the data from Serial3, Serial0 is also in use, but inconsequential to this step.

I think my problem is that Serial.println is noticing the type of data that is presented and processing it properly for printing, but that I am missing a step in the if comparison to properly match the entire string. Any ideas would be appreciated. I’ve done a lot of searching on “Arduino Serial Read String Comparison” and many similarly worded searches have turned up nothing useful, for me. for help]"
  if(data3 == "Grbl 0.9a [’


Serial2 is my debug monitor and I am reading the data from Serial3, Serial0 is also in use, but inconsequential to this step.

I think my problem is that Serial.println is noticing the type of data that is presented and processing it properly for printing, but that I am missing a step in the if comparison to properly match the entire string. Any ideas would be appreciated. I've done a lot of searching on "Arduino Serial Read String Comparison" and many similarly worded searches have turned up nothing useful, for me. for help]") // GRBL Init String, this comparison never works
  {
    Serial2.println("CNC: Startup string received");
  } 
  else
  {
    Serial2.println("No Match");
  }
}

Serial2 is my debug monitor and I am reading the data from Serial3, Serial0 is also in use, but inconsequential to this step.

I think my problem is that Serial.println is noticing the type of data that is presented and processing it properly for printing, but that I am missing a step in the if comparison to properly match the entire string. Any ideas would be appreciated. I’ve done a lot of searching on “Arduino Serial Read String Comparison” and many similarly worded searches have turned up nothing useful, for me.

You can not use == to compair strings, you need the C compair string function.

Excellent, thank you :)

Replaced

if(data3 == "Grbl 0.9a ['

With

if(strcmp(data3,"Grbl 0.9a ['

Working fine now. for help]") // GRBL Init String, this comparison never works ```

With

§_DISCOURSE_HOISTED_CODE_1_§

Working fine now. for help]") == 0) // GRBL Init String ```

Working fine now. for help]") // GRBL Init String, this comparison never works ```

With

§_DISCOURSE_HOISTED_CODE_1_§

Working fine now.