If I hard code like:
//ESP32_FTPClient ftp("host.ftpserver.com", "ftpuser", "ftppass"); //WORKS OK
Code: Select all
preferences.begin("AppParms", true);
String myserver = preferences.getString("ftpServer","");
String myuser = preferences.getString("ftpUser","");
String mypass = preferences.getString("ftpPass","");
preferences.end();
char* ftp_server[32];
char* ftp_user[32];
char* ftp_pass[16];
strncpy(myserver.c_str(), ftp_server, 32); <-----
strncpy(myuser.c_str(), ftp_user, 32);
strncpy(mypass.c_str(), ftp_pass, 16);
Char is required to initialize:
ESP32_FTPClient ftp(ftp_server, ftp_user, ftp_pass);
That refuses to accept:
ESP32_FTPClient ftp(myserver.c_str(), myuser.c_str(), mypass.c_str());
My system=ESP32 and lib in use:
// FTP Client Lib
include "ESP32_FTPClient.h"
Code: Select all
char* ftp_server[32];
char* ftp_user[32];
char* ftp_pass[16];
myserver.toCharArray(ftp_server, sizeof(ftp_server));
myuser.toCharArray(ftp_user, sizeof(ftp_user));
mypass.toCharArray(ftp_pass, sizeof(ftp_pass));
no matching function for call to 'String::toCharArray(char* [32], unsigned int)'
******************************************************************************************
Problem solved!
Code: Select all
char ftp_server[32];
char ftp_user[32];
char ftp_pass[16];
//FTP parameters
preferences.begin("AppParms", true);
strncpy(ftp_server,preferences.getString("ftpServer").c_str(), sizeof(ftp_server));
strncpy(ftp_user,preferences.getString("ftpUser").c_str(), sizeof(ftp_user));
strncpy(ftp_pass,preferences.getString("ftpPass").c_str(), sizeof(ftp_pass));
preferences.end();
ESP32_FTPClient ftp(ftp_server, ftp_user, ftp_pass);