hi i have a file which contains following lines:
wwa weweweof ewewe wdw:
1 11 ms <1 ms <1 ms 174.78.134.1
2 11 ms <1 ms <1 ms 174.78.134.1
3 5 ms <1 ms <1 ms x58trxd00.abcd.edu.com [143.71.290.42]
4 11 ms <1 ms <1 ms 174.78.134.1
i am using
if(linecount == 8)
while( fscanf(fp, "%d %s %s %s %s %s %s",&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8) != EOF ){
printf("%s",ch);
}
else if (linecount == 9){
while( fscanf(fp, "%d %s %s %s %s %s %s %s",&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9) != EOF ){
printf("%s",ch);
}
}
how do i check if the line rows in the file contain 8 or 9 elements, so that i can run the above else-if statements accordingly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…