Updating record in random access file dating single dad forum
: Now, that the record-to-be-updated 055 RAKESH 1650000 20080217 is stored in EMP-ID, EMP-NAME, EMP-AGE, EMP-SALARY and EMP-JDATE Fields, you supply the new values for the fields that you want to change.
Say, I want to increase Rakesh's salary to 17.5k, so I just change the EMP-SALARY Value. This makes my new record 055 RAKESH 1750000 20080217, leaving the rest fields undisturbed.
This is a common arrangement for variable length records, and has the advantage the the file pointer is already positioned at the start of the record data after the record length has been read.
U are getting garbage value is may be because u are not reading in the way u wrote to that file.U have to use fwrite() for writting then only u will get correct values using fread(). Otherwise u have to get a copy of either turbo C or borland C and put it in your machine.