我有下面的代碼。問題在於,當我運行它時,它沒有爲我搜索到的搜索顯示任何內容;嘗試printf("%s", strstr(tracks[i], search_for))裏面爲,帶回空,但沒有問題做跟蹤[i]和search_for。請幫忙!。 #include <stdio.h>
#include <string.h>
char tracks[][80]={
"I left my he
有人可以告訴我爲什麼p總是NULL,即使strstr正確找到(在搜索功能)?我從文件中填充結構數組。對不起,重新發帖this other question但他們都沒有幫助。 #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
struct player {
int no,
我想在c中創建一個代碼,用於搜索使用strstr()函數在txt文件中找到字符串的次數。 我用strastr()做了一個測試代碼,但是我有一個問題。 例如,我有類似" this is a text"的句子,當我搜索"is"時,我得到一個結果"is found 2 times",因爲它從「this」取「is」。我不想從thisis我想「是」作爲唯一的字。我可以搜索沒有這個「問題」與的strstr()