2012-12-06 49 views
0

如果我選擇一個包含單詞列表的文本文件,並且希望將此列表與多個列表進行比較(已經源於該程序)意味着如果輸入列表中的任何單詞與任何來源列表中的單詞匹配,我希望該單詞僅在該單詞在list1.txt中找到時才存儲在文件a.txt中)。同樣如果在list2.txt中找到該單詞,我希望它被存儲在b.txt中。除此之外,我想在輸出文件a.txt中顯示文件list1.txt的路徑。 像 唱./dataset/dictionary/verb將列表與其他列表進行比較,然後在新列表中匹配時存儲結果

我用下面

while(dictcount >= 0)//reads dictionary word into array// 
{ 
    dictcount = 0; //searches through all of the listed data files 
    fscanf(fp1,"%s", worddict); 
    fscanf(fp2,"%s", worddict); 
    fscanf(fp3,"%s", worddict); 
    if(strcmp(wordcheck, worddict)==0)//compare strings//if the word in found in list misc.txt 
    { 
     fprintf(out_file1 ,"%c", wordcheck); //storing the value in output_misc.txt 
     if (getcwd(cwd, sizeof(cwd)) != NULL) 
     //fprintf(out_file3, "%c\n", cwd); //stores the path of the folder containing the list in which the matched 'word' is found 
      return 0; 
    } 
} 
+0

我們是否假設有一個fprintf()調用的瘋狂邏輯,最終會將指針*值*('wordcheck')降級爲char('%c'),編寫所述-char到輸出文件? – WhozCraig

回答

相關問題