char and string error's...

#include <Keypad.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49, 51, 53);
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {3, 2, 8, 9};
byte colPins[COLS] = {7, 6, 5, 4};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
int PWC = 0;
String ENPA="";
String len="";
void setup(){
  lcd.begin(16, 2);
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  pinMode(13, OUTPUT);
}

void Flash(int ti){
  digitalWrite(13, HIGH);
  delay(ti);
  digitalWrite(13, LOW);
}

void loop(){
  lcd.setCursor(0, 0);
  lcd.print("Enter Password:");
  lcd.setCursor(0, 1);
  while(not PWC == 1){
  char customKey = customKeypad.getKey();
  if (customKey){
    lcd.print("#");
    tone(11, 1000, 50);
    Flash(50);
    ENPA += customKey;
    len = strlen(ENPA);
    Serial.println(len);
  }
}
}

I would like to have what im pressing added to a string so that each press adds to it.

Eventually when the string is 4 characters long it will be compared to a stored variable (a password), and then if it matches you will be notified.

Yes, i realize people have made code for this exact purpose.. But this is MY idea, lol.

Please help

Error-

Enter_pass:43: error: cannot convert 'String' to 'const char*' for argument '1' to 'size_t strlen(const char*)'
** len = strlen(ENPA);**
** ^**
exit status 1
cannot convert 'String' to 'const char*' for argument '1' to 'size_t strlen(const char*)'

I would like to have what im pressing added to a string so that each press adds to it.

C style strings (lowercase s) are arrays of chars terminated with a zero. Strings (capital S) are String objects.

    ENPA += customKey;
    len = strlen(ENPA);

Here you are using strlen() which expects a string as a parameter but ENPA is a String. Either use Strings throughout or strings throughout. I am sure that there must be a function in the String library that returns the length of a String or alternatively keep track of its length with a counter variable.

In the longer term you would probably be better using strings and adding each character to the array as you go. This method is reckoned to use less memory and does not cause memory fragmentation.

I am sure that there must be a function in the String library that returns the length of a String

Yes, there is. For some strange reason, it is called length().

length() only returns error

exit status 1
'length' was not declared in this scope

Try ENPA.length()

#include <Keypad.h>
#include <LiquidCrystal.h>
#include <stdlib.h>
#include <string.h>
LiquidCrystal lcd(43, 45, 47, 49, 51, 53);
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {3, 2, 8, 9};
byte colPins[COLS] = {7, 6, 5, 4};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
int PWC = 0;
String ENPA;
int len = 0;
char customKeyn[1];
void setup(){
  lcd.begin(16, 2);
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  pinMode(13, OUTPUT);
}

void Flash(int ti){
  digitalWrite(13, HIGH);
  delay(ti);
  digitalWrite(13, LOW);
}

void loop(){
  lcd.setCursor(0, 0);
  lcd.print("Enter Password:");
  lcd.setCursor(0, 1);
  while(not PWC == 1){
  char customKey = customKeypad.getKey();
  if (customKey){
    char customKeyn = customKey;
    Serial.println(customKeyn);
    lcd.print("#");
    tone(11, 1000, 50);
    Flash(50);
    ENPA =  ENPA + customKeyn;
    len = ENPA.length();
    Serial.print("ENPA: ");
    Serial.print(ENPA);
    Serial.print(" -- ");
    Serial.println(len);
  }

  }
}

Well somehow it is working....
Thank you guys!!!!!!!

Sorry about not replying. Finals all this week :grinning: