Traverse FILE line by line using fscanf

后端 未结 4 813
情话喂你
情话喂你 2021-01-03 03:08

Ok so i have a text file database.txt.

Each line is a user with the format below

\"John Smith\"| 4| 80.00| \"123 Lollipop Lane\"| \"New Jersey\"| \         


        
4条回答
  •  -上瘾入骨i
    2021-01-03 04:11

    You have to use fgets, instead of fscanf!The fscanf reads until it meats \n (new line) character ,whereas you can use fgets to read all lines with the exact same code you used! Hope that helped :)

提交回复
热议问题