我尝试使用 strstr()
来查找双引号 (") 的第一次出现,但是,当我使用这行代码时:
pch = strstr(tmp,""");
它不会编译,因为我没有终止引用。所以我用了
pch = strstr(tmp,'"');
然后告诉我有一个这样的错误:
passing argument 2 of ‘strstr’ makes pointer from integer without a cast [enabled by default]
pch = strstr(tmp,'"'); //finds the first occurrence and deletes the preceeding
^
In file included from /usr/include/stdio.h:29:0,
from assignment1.c:1:
/usr/include/string.h:40:8: note: expected ‘const char *’ but argument is of type ‘int’
char *_EXFUN(strstr,(const char *, const char *));
对此有什么想法吗?或者有人知道使用 strstr
检测双引号字符的方法吗?也许可以进行 ASCII 转换?
最佳答案
使用pch = strstr(tmp,"\"");
它会起作用
关于c - 如何将“放在C中的字符串内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26828342/