我想创建一个方法来查找并替换字符串中的字符串,但我似乎在编译时有一些错误。我可以帮助弄清楚发生了什么事吗?未定义的引用stricmp
void replaceString(char *find, char *replace)
{
int len_string,i;
char temp[30];
len_string=strlen(find);
while(1)
{
for(i=0;i<len_string;i++) temp[i]=fgetc(edit);
temp[i+1]=NULL;
/* the stricmp() is used for comparing both string. */
if(stricmp(find,temp)==0)
{
fprintf(edit,"%s ",replace);
fclose(edit);
exit(1);
}
fseek(edit,-(len_string-1),1);
}
}
我在编译时得到的错误是对stricmp的未定义引用。 我知道这是不正确的编码约定,但编辑(FILE类型的对象)当前是一个全局变量。
不仅针对Windows,而且针对微软的编译器/库。我不认为你会在Windows的其他编译器中找到它。 – metamatt 2011-05-07 02:24:02
感谢您的帮助 – Jonathan 2011-05-17 03:03:34
Borland Turbo C也提供了此功能。 – 2013-02-14 20:47:34