c++Builder 2009 2010 出现Cannot convert 'wchar_t *' to 'const char *

来源:互联网 发布:用java写雷电x 小游戏 编辑:程序博客网 时间:2024/06/06 04:02

Function(char * some)

Function(edit->Text.c_str())  //结果就在这行出现Bug Cannot convert 'wchar_t *' to 'const char *


解决方法

菜单"Project"-》“Options”-》“Directories and Conditionals ”选项

_TCHAR maps to    char

上面代码改成Function(edit->Text.t_str()) ;  


引用c++ Builder 妖刀版主的

2009中的String有三个转换成字符串指针的函数:
c_str() 这个应该是为了兼容旧版本的代码,返回类型为wchar_t *
w_str() 返回wchar_t *
t_str() 这个函数的返回值依赖工程选项中_TCHAR的映射类型,如果映射为char,返回char *,映射为wchar_t,返回wchar_t *




0 0
原创粉丝点击