Results 1 to 2 of 2

Thread: search for characters within a file and overwrite them

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Sligo, Ireland
    Posts
    15

    Question

    I want to overwrite certain characters within a file
    for example if a file contained the characters "FT"
    I want to search for the occurrence of "FT" and overwrite it with "HT"

    Does anybody know of an API or function which will carry out this task

    any help is greatly appreciated

  2. #2
    Matthew Gates
    Guest
    Code:
    Dim sText As String
    
    Private Sub Command1_Click()
        Open "C:\MyFile.txt" For Input As #1
            sText = Input(LOF(1), 1)
            sText = Replace(sText, "FT", "HT")
        Close #1
    End Sub
    
    Private Sub Command2_Click()
        Open "C:\MyFile.txt" For Output As #1
            Print #1, sText
        Close #1
    End Sub

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