CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2003
    Posts
    103

    Lightbulb Who help me with this problem????

    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

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Can you try explaining what the problem is a bit more clearly?
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Jan 2003
    Posts
    103
    Sorry. My English is poor

  4. #4
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    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...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  5. #5
    Join Date
    Jan 2003
    Posts
    103
    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.

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    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...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured