使用gcc编译C99使用strcmp比较
我想比较使用字符串比较的2个字符串。 但是,我似乎在strcmp行上得到堆栈转储。
**属性将包含这些,所以我正在寻找frametype。
[name] [time] [type] [time]
[name] [callref] [type] [string]
[name] [port] [type] [int16]
[name] [frametype] [type] [int16]
这是正确的比较方式。
非常感谢您的任何建议,
void g_start_element(void *data, const char *element, const char **attribute)
{
for(i = 0; attribute[i]; i++)
{
/* Only interested in the frametype */
if(strcmp(attribute[i], "frametype") == 0)
{
/* do some work here */
}
}
}
如果您将此代码更改为使用strncmp(),您会传入'n'什么?这在这种情况下会有什么帮助? – bk1e 2009-03-06 07:31:53