Click to See Complete Forum and Search --> : Who help me with this problem????


cntomcom
January 5th, 2003, 10:34 PM
I read and write strings using RandomAccessFile and strings in
my file are just as follow:
string1/n
string2/n
...
stringn/n
For example, when I read string2 from file and the length of string2 is 4. Now I add or remove something to the string and the length become more or less, then I save it. But when I read it
from file again, I find it's changed.
string1/n
string21/n
string22/n
...
stringn/n

dlorde
January 6th, 2003, 06:25 AM
Can you try explaining what the problem is a bit more clearly?

cntomcom
January 6th, 2003, 09:03 AM
Sorry. My English is poor :)

dlorde
January 6th, 2003, 05:58 PM
I think your English is good enough, but you need to give more details. You say you read the file and the length of a string is 4.

OK. Then you add something to or remove something from the string, so the string length changes, then you save the modified file. OK, so you have changed the file contents, one of the strings is now a different length...

Then you say that when you read the file again, it has changed. What, exactly, has changed? The file has changed, of course - you just changed the contents... Is the string you read in different from the string you wrote out?

What is it that has changed, and why is this change unexpected?

How do the file contents you posted show the problem?



the agressive whine of angry hornets was all around them now...

cntomcom
January 7th, 2003, 01:36 AM
For example, the content in the file is:

1234567891/n
apple/n
11/n
11/n

If I changed the string, "apple" into "app", or into "orange", then
the 3rd line and the 4th line also changed.

dlorde
January 7th, 2003, 04:33 AM
You'll have to post the relevant code, because I can't guess what's going wrong from so little information.

Nobody told him it was loaded with live rounds...