String value to char const value convert...how?

on Arduino code...

I defined apname as String.

String apName = "es88";

and on Setup() method.

WifiManager.autoconnect(apName);

but auto connect method 's first parameter should be char const.

so. If I run above code, I have error saying
no know conversion for argument 1 from 'String' to 'const char*'

How can I define globally and use it ?

kotran:
on Arduino code...

I defined apname as String.

String apName = "es88";

that's a bad idea :slight_smile: - don't use the String class on small micro-controllers

an array of char of a pointer to a char cstring would do...

kotran:
and on Setup() method.

WifiManager.autoconnect(apName);

but auto connect method 's first parameter should be char const.

see.. you would not have had the issue :slight_smile:

kotran:
so. If I run above code, I have error saying
no know conversion for argument 1 from 'String' to 'const char*'

How can I define globally and use it ?

use ... const char * apName = "es88";orconst char apName[] = "es88";

You need to learn about c-strings: arrays of char terminated by ‘\0’. This is the standard way of doing strings in the C programming language (C before C++ was invented).

libc, which is part of the arduino build environment, contains several functions used to deal with this type of string

The documentation is here.