2012-12-06 52 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

回答

相关问题