I have an application which is supposed to write data into a file in the reverse order. The values are stored in four strings S1, S2, S3 and S4. The length of each string is variable.
Following is the algorithm:
1. Open the File.
2. Write S1
3. Move to the beginning of the file.
3. Write S2
4. Move to the beginning of the file.
5. Write S3
6. Move to the beginning of the file.
7. Write S4
8. Close the file.
On completion the intended sequence in the file should be as follows:
<S4>,<S3>,<S2>,<S1>
The problem is that the current string seems to overwrite the previous one completely or partially depending on the length of the former.
Anybody knows how I could overcome this problem?
Following is the algorithm:
1. Open the File.
2. Write S1
3. Move to the beginning of the file.
3. Write S2
4. Move to the beginning of the file.
5. Write S3
6. Move to the beginning of the file.
7. Write S4
8. Close the file.
On completion the intended sequence in the file should be as follows:
<S4>,<S3>,<S2>,<S1>
The problem is that the current string seems to overwrite the previous one completely or partially depending on the length of the former.
Anybody knows how I could overcome this problem?