String to char[16]?

Im using Wstring lib.
i created a string and a char like so:

String inString = String(16);       // The string created by the user pressing keys
char Password[16] = ("123ABC");     // The default password

I type in the key pad and add to the string like so:

  {
      case '1':
        mySerial.print("1");
        inString.append('1');
        break;
      case '2':
        mySerial.print("2");
        inString.append('2');
        break;
      case '3':
        mySerial.print("3");
        inString.append('3');
        break;
      case '4':
        mySerial.print("4");
        inString.append('4');
        break;

i can compare to see if the user typed the correct password like so:

 if (inString.equals(Password)) {

All things above work good. I basically used the sample code with the lib.
Sample code below

#include <WString.h>                // include the String library

#define maxLength 30

String inString = String(maxLength);       // allocate a new String
boolean answerComplete = false;

void setup() {
  // open the serial port:
  Serial.begin(9600);
  // Say hello:
  Serial.print("String Library version: ");
  Serial.println(inString.version());
  // print the question:
  askQuestion();
}

void loop () {
  // get anything the user typed:
  if(Serial.available() > 0) {
    getIncomingChars();
  }
  // if they've finished answering, check the answer:
  if (answerComplete == true) {
    if (inString.equals("monkey")) {
      Serial.println();
      Serial.println("That's right, and don't you say otherwise.");
      Serial.println();
      answerComplete = true;
    } 
    // if they got it wrong, tell them:
    else {
      Serial.println("Wrong. Loser."); 
    }
    // clear the string and ask again:
    inString = "";
    askQuestion(); 
  }

}

void askQuestion() {
  Serial.print("What's the coolest animal?"); 
  answerComplete = false;
}

void getIncomingChars() {
  // read the incoming data as a char:
  char inChar = Serial.read();
  // if it's a newline or return, print the string:
  if ((inChar == '\n') || (inChar == '\r')) {
    Serial.println(inString); 
    answerComplete = true;
  } 
  else {
    // if you're not at the end of the string, append
    // the incoming character:
    if (inString.length() < maxLength) {
      inString.append(inChar);
    }
    else {
      // empty the string by setting it equal to the inoming char:
      inString = inChar;
    }
  }
}

Only difference is im not reading data so i can’t put it into a char 1st, i think…

The Problem****

So i’m trying to change my password. Code below errors and says i cant go from string to char[16].

case 1:
         Password = inString;
         mySerial.print("?fNEW PASSWORD SET");
         break;

ive tried many variatioons here. I can convert inString to an INT by using atoi(). just didn’t see anything on string to char. So similar yet so different…

Also if i change Password to a String then this part of the code works but the compare password(inString.equals(Password)) part of the code errors.

Help pls

Hi,

use the function getChars() to copy the characters from String to char array.

Mike