【发布时间】:2023-03-05 16:28:02
【问题描述】:
while (exit!=true )
{
input sprintf(thename, "person%d.txt", thecounter);
searchfile=fopen(thename,"r");
fscanf(searchfile,"%d%s%s%f%f\n",&theperson.id,theperson.firstname,theperson.lastname ,&theperson.sallary , &theperson.saving);
numfirst =strcmp(inputfirstname,theperson.firstname);
numlast = strcmp(inputlastname ,theperson.lastname);
if ( numfirst == 0 || numlast == 0 )
}
到目前为止,如果我不使用循环并直接指向位置文件,我一直在尝试使其唯一有效。
我想搜索,尽管有条件,它仍然保持无限循环,顺便说一句,这不是完整的代码,因为我无法将整个模块粘贴到增量和 fclose 条件
【问题讨论】:
-
首先代码不完整..
-
该代码不适用于拼写检查。
-
它不完整,因为我不知道如何将整个代码放在这里。问题是为什么这段代码是无限循环的。它有点像拼写检查器而不是 100% 拼写检查器认为基本思想是使用 strcmp 比较输入和文件之间的关系
标签: c file loops pointers spell-checking