我收到以下错误:
2 smartcard.c: In member function ‘virtual bool cSmartCards::ParseLine(const char*, bool)’:
3 smartcard.c:1187:25: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
4 char *r=index(line,':');
5 ^
Run Code Online (Sandbox Code Playgroud)
代码是:
1184
1185 bool cSmartCards::ParseLine(const char *line, bool fromCache)
1186 {
1187 char *r=index(line,':');
1188 if(!r) return false;
Run Code Online (Sandbox Code Playgroud)
包括我 "string.h"
我怎样才能改写第1187行?
index()可以在string.h中找到.
以下任一或两者:
index回报const char*,而不是char*.所以,做r一个const char*,而不是一个char*.
该函数index被编写为期望a char*,而不是a const char*.在不知道什么index是和不做的情况下,我无法安全地建议解决这个问题.
| 归档时间: |
|
| 查看次数: |
1926 次 |
| 最近记录: |