Reading and Writing to a File

I am very confused with this assignment:

Write a program that uses a structure to store the following information in a file:

Item Description
Quantity On Hand
Wholesale Cost
Retail Cost
Date added to to inventory

Then the program should have a menu that allows the user to perform these tasks:

Add new records to the file
Display any record in the file
Change any record in the file


My confusion is with the file itself. Just what exactly are you supposed to write in the file? Can you create this file while coding the program? Or do you have to have some preset information inside it? For example: If I wanted to access a file named inventory.dat, would I need to have information inside it, or can this file be created while the program is getting coded?

So now in relation to the program that I need to write, Do I put the item descriptions that I mentioned above inside the file before writing the program? Or can they just be put inside the code and then the file can be modified by the user and then saved to this file? Very confused about files here....
Programming wouldn't be much of a tool if it couldn't even create files, now could it?

Yes, you can create files. You can move, delete, and manipulate them too.
Usually, you don't create an entire library to do it in scratch. That's what an operating system is there. You use your OS's libraries to read/write/delete files.
I'm guessing you use MS Windows, right?
Refer to this.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx
Topic archived. No new replies allowed.