fscanf with while loop

assume $num is the number what you assign through scanf or fscanf or sscanf and so on.

while (fscanf(fileptr, formatstring, &var1, &var2,...)!=$num) {
    //do some thing.      
}
fclose(fileptr);

if you encounter invalid pointer, check memory and pointer operation anywhere first.
because i have written this template but still stuck with invalid pointer. i found other pointer operation error finally.

posted @ 2021-10-20 12:01  ijpq  阅读(36)  评论(0编辑  收藏  举报