NicePerson Posted August 26, 2010 Share Posted August 26, 2010 I want to make a script which will read a text file (which contains a long list of names) and write every name seperated . for example write a new file with : some text & first name from the first read text file and so on. how to start this? any example?? Link to comment Share on other sites More sharing options...
majidemo Posted August 26, 2010 Share Posted August 26, 2010 Reading a File? $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in 1 character at a time until the EOF is reached While 1 $chars = FileRead($file, 1) If @error = -1 Then ExitLoop MsgBox(0, "Char read:", $chars) Wend FileClose($file) Writing to a File? $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, "Line1") FileWrite($file, "Still Line1" & @CRLF) FileWrite($file, "Line2") FileClose($file) or you can use the FileReadLine or FileWriteLine... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now