我想創建一個方法來查找並替換字符串中的字符串,但我似乎在編譯時有一些錯誤。我可以幫助弄清楚發生了什麼事嗎?未定義的引用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