Results 1 to 2 of 2

Thread: Help using the seek and put statements

  1. #1

    Thread Starter
    Lively Member mrdarkwarez's Avatar
    Join Date
    Feb 2000
    Location
    Australia
    Posts
    113
    there is a text file containing several lines of text, how do i use the seek statement to obtain the writing position for a certain place corrosponding to the string character i want??

    Eg.
    ///////
    this is a test ok
    second line

    forth line, and the last line.
    /////////

    how do i get the above to appear like the below using the
    seek and put statment??

    ///////
    this is a test ok
    second line

    forth line, and the las[new string entry]t line.
    /////////

    thanks in advance


  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I don't know how you want this. You can't use the the put and seek to do this. Seek will get the current position where to write next and Put will overwrite. But for your example:
    ------------------------
    fnum = FreeFile
    Open filename For Binary As fnum
    file = Space(LOF(fnum))
    Get #fnum, , file
    Close fnum
    file = Left(file, pos) & newtext & Mid(file, pos + 1)
    Open filename For Binary As fnum
    Put #fnum, , file
    Close fnum
    -------------------------
    Hope this helps

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