Hi
I wanted to carry out simultaneous file i/o using a single handle. I used the fstream object to open the file with the "ios::in | ios:ut" protocol. I used the seekg (), read () and write () methods to search within the file, and read and write structures to the file respectively. The problem that I am facing is that when I modify record no. 10 for example by
1) Using seekg () to reach that location within the file and
2) Using write () to update the record
the values in record no. 11 change. I find that this happens only when the total number of digits of record no. 10 are increased (changing a field of value 9 to 10 for example). I don't know why this is happening. As the data is in binary format, the appropriate amount of space should be allocated for each record (12 bytes per record in my case). No problem occurs if the number of digits are unchanged.
I'm tearing my hair out!!! Please help!!!
I wanted to carry out simultaneous file i/o using a single handle. I used the fstream object to open the file with the "ios::in | ios:ut" protocol. I used the seekg (), read () and write () methods to search within the file, and read and write structures to the file respectively. The problem that I am facing is that when I modify record no. 10 for example by
1) Using seekg () to reach that location within the file and
2) Using write () to update the record
the values in record no. 11 change. I find that this happens only when the total number of digits of record no. 10 are increased (changing a field of value 9 to 10 for example). I don't know why this is happening. As the data is in binary format, the appropriate amount of space should be allocated for each record (12 bytes per record in my case). No problem occurs if the number of digits are unchanged.
I'm tearing my hair out!!! Please help!!!