willwatters Posted January 20, 2005 Share Posted January 20, 2005 What is the code please to be able to read data from a file (in the format: name, password per line) and storing the name and password as two separate variables? I'm planning on doing a loop to read the records (name and password) but how can i count the number of records so I can store it as a variable for the loop? Thanks Link to comment Share on other sites More sharing options...
ezzetabi Posted January 20, 2005 Share Posted January 20, 2005 (edited) RTFM In particular, check: FileReadLine() StringSplit() StringStripWS() A little example script: $filename = '' $h = FileOpen($Filename,0) If $h <> -1 Then While 1 $line = StringStripWS(FileReadLine($h),7) If @error Then FileClose($h) ExitLoop EndIf $line = StringSplit($line,',') If $line[0] >= 2 Then MsgBox(0,'','Name ' & $line[1] & @lf & 'Pass ' & $line[2]) EndIf WEnd EndIf Edited January 20, 2005 by ezzetabi 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