Updating a file random

Rated 3.98/5 based on 734 customer reviews

The update function should then update the name field of the record. You have to change it to something like a linear search if you do. In the update function, I'd like to have the user enter an id Number of a tool and then have them enter a name which corresponds to the id number. I'd suggest you structure you code a bit different. But even if we assume that you just use fread, fwrite and the like then ask yourself what happens if you have Tool t1 = {5,12,123.0,"Some name") Tool t2= {100, 1,1234.0, "Some other name"); How can fseek work that way.

100 is the maximum number of records, 4 is the number of used records. You can search the index records for a given id and calulate record number and position.

But that means there are so many control flows possiblities in one function that it's unbelievable difficult to "get them all" You have to do more test in a functiion but at least you have steady flow from the beginning of some function to it's end.

Howerver one is for sure error handling in C is not really easy. That is necessary at Windows platform but not not at UNIX.

= EOF) and the like and one has to be able to read that stuff.

But there is not need to obfuscate the work intended to be done in C although i have the impression the C folks like that all too much.

Leave a Reply