FileWrite at certain line..?

Discussion in 'Questions (Windows Mobile)' started by TWELVE, May 11, 2008.


    TWELVE Active Member Licensed User


    i'm trying to write a line to a certain position within a file.My plan was to use FileRead to get to the position i'm looking for and then FileWrite to change the content of this line.

    This doesn't work, because i cannot open a file for read & write access at the same time.I saw there is also FileGet and that stuff with cRandom access but i would like to stay with line based string access and not counting bytes in the file.

    How can i achieve this..?


  2. Cableguy

    Cableguy Expert Licensed User

    The easiest way i can think off, is to read and load the whole file to a table, apend the data you want, were you want it, and them save the file again overwriting the existing one...
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can open the file for reading.
    Open a new file for writing.
    Read each line from the original file and write it to the new file.
    Add the new line when you reach its location.
  4. konisek

    konisek Member Licensed User

    I would like to use FileWrite and add a string (or strings) to the first line in the file. Is there a simple way or do I have to use the way you have described before as the only one solution? (L)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice