ファイル内の行数をチェックするコードが1つあります。ファイルには6行あります。私は新しい行 '/ n'と比較しようとしますが、結果はOKではありません。ここにコードがあります。あなたのコードに:)C - 新しい行との比較
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE*code;
int NumbRow = 0;
char c;
code = fopen("SMS.txt", "r");
if(code==NULL)
{
printf("I cant read from file");
return;
}
again:
while ((c=fgetc(code)) !=EOF)
{
if (c=='/n')
{
NumRow ++ ;
}
if (c!='/n')
{
goto again;
}
}
printf ("Number of rows is : %d", NumRow);
return 0;
}
Hmmm。 "しかし、結果はOKではない"非常に正確な問題の声明ではありません。 –
'goto'とは何ですか? – pinkfloydx33