Jump to content

FileWrite to line number 1


 Share

Recommended Posts

File 'test.txt' contains few lines of text, like here:

Line1
Line2
Line3

and when I run this code:

$file = FileOpen("test.txt", 1)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, "Something")


FileClose($file)

my file would now looks like that:

Line1
Line2
Line3Something

Now, how to erase all lines in that text file and put this "Something" text to ONLY line 1

after run this code it should looks like that:

"Something"

(only 1 line)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...