We are supposed to make a program.. and I have a problem.. It's a inventory program, and on the 1st option, you'll add things in the inventory.. on the 3rd option.. you have the option to cut the price... on the second option.. you need to display the changes you made in the txt file... my problem is, i can't change the price on the txt file.. the 'change' just goes after the last data entered.. it's in append mode since i've read that it will erase all the data inside the txt file if it is in write mode... i've tried to create pointers in my structure but it still doesn't work..

Recommended Answers

All 2 Replies

One way to do it is to create a change file that contains both the old and new values. Then to display all the changes just read that change file. As for the original file, if its a standard text file you will have to completly rewrite the file every time you want to make a change to a records that's already in the file. If you make it a fixed-length record file then you could change the record directly without rewriting the file.

Give the thread a meaningful title next time.
If you provide some code to show what you have tried so far and better explain what the problem is I'm sure more people will be willing to help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.