[cpp]: 常量字符串的声明(const char* const localeName = "zh_CN.utf-8")
[cpp]: 常量字符串的声明(const char* const localeName = "zh_CN.utf-8")
一、说明
1、编译环境: g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.83.0-gcc-13.2.0/include -std=gnu++2b
2、声明常量字符串: 【 const char* const localeName = "zh_CN.utf-8" 】
二、代码
1 #include <iostream>
2
3 int main()
4 {
5 // constant strings declaration
6 const char* const localeName = "zh_CN.utf-8" ;
7
8 std::cout << localeName << std::endl ;
9
10 return 0 ;
11 }
三、运行结果
1 g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.83.0-gcc-13.2.0/include -std=gnu++2b
2
3
4
5 zh_CN.utf-8
四、参考资料
1、 std::filesystem::path::string -- https://en.cppreference.com/w/cpp/filesystem/path/string
本文由lnlidawei(https://www.cnblogs.com/lnlidawei)原创或整理,转载或引用时请注明出处。