Serial read to int -> overflow?

Hello,

i'm trying to send 433Mhz wifi codes using rcswitch lib.
when i enter the number from the remote control, the output is another number :confused:
so how can i convert the input to an integer that i can pass to the send function without overflow?
Largest number is around 9432208.

here is what i already tried:

    if (readString.length() > 0) {
      Serial.print("Input: ");
      //Serial.println(readString);  //so you can see the captured string
      //int n = readString.toInt();  //convert readString into a number
      int intLength = readString.length() + 1;
      readString.toCharArray(intBuffer, intLength);
      int n = atoi(intBuffer);
      //int n = Integer.valueOf(readString);
      Serial.println(n);  //so you can see the captured string
      mySwitch.send(n, 24);
      readString = "";
      delay(100);
    }

I did not read code but would say start by not using an int, use an unsigned long
(And don't use the String class)

      long n = readString.toInt();  //convert readString into a number

should work. Despite its name, toInt() returns a long value.

Best would be not to use String at all.

Thanks! Using long worked.