~Lately , I've been struggling a lot w/ file handling in c ,is there any other way to store data in c?
I'm working on a project that analyze company's stocks for you, so in that ,
~firstly I've to store password , name , no. of stocks ,company name , no of shares of each company , price of each share , total .
~Secondly , if the user wants to see his/her portfolio ,he/she has to insert the password and I'll compare that password w/ previously inserted passwords of users and then show his/her portfolio.
Thirdly , if the user want to delete any specific company's stock .
And currently , i'm on the second part where I've to display portfolio . I'm using fscanf to read the data , but sometimes it didn't stop at the end of file and also I don't how to correctly read lines with it.
CodePudding user response:
Using C, you can store your data in binary
or text
formats. CSV, JSON, XML, atom, et al are all text
files with some syntax and semantics, that is all. C has all abilities to store in whichever format you desire. Read about the various IO functions, like fscanf
, fread
, etc.