-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help -- How to read config from a String #179
Comments
Hi. Can you be more specific? Maybe post a code snippet so I can see what you want to do? Otherwise, you may want to look at the sample sketches that show how to use a format string and sprintf() to fill in values.
… On Oct 20, 2021, at 10:55 AM, wilson405 ***@***.***> wrote:
hi,
everything works perfectly, I just need a help, I need user and password, to be read from a string, because I will store it in Spiffs, can someone help me.
example :
char user[] = here string ;
char password[] = here string;
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#179>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB6SHYHR5XQFWOY3LRVLHNDUH3J77ANCNFSM5GL3OWIQ>.
|
Hi Sir ChuckBell, in my code > IPAddress server_addr(myserver); // IP of the MySQL server here I would like to read the username, password and database from a String that I have stored in a variable, how do I convert the variable that is a String to the char * ? Would you help me ? |
I am not familiar with SPIFF (from the ESP world), but to convert a string to a char *, you would use the c_str() method to get the char * pointer. For example, say you read the user name into a string something like this: String user = something.spiff_read(); To use the user (which is a String class) as a char *, just call the c_str0 method like this: connect(user.c_strr()... There is no need to copy the string to a char * buffer. |
hi,
everything works perfectly, I just need a help, I need user and password, to be read from a string, because I will store it in Spiffs, can someone help me.
example :
// database user and password
char user[] = here variable type String ;
char password[] = here variable type String;
The text was updated successfully, but these errors were encountered: