Bi0haZarD Posted September 10, 2005 Share Posted September 10, 2005 (edited) ok, found an app that gets all the info about a ventrilo server. and i'm trying to read the text file that i make using a .cmd file...so... in the .cmd file i haveventstat.exe 192.168.0.102 > stat.txtnow in my code i have a function called _read()Func _read() Local $stat If FileExists("stat.txt") Then $stat = FileRead("stat.txt", FileGetSize("stat.txt")) Return $stat Else SetError(1) Return -1 EndIf EndFuncnow for the really weird part...I read the text file like normal however.. it only gets the first part of the text file.. if i open it in notepad then re save it, it gets all the info...any idea of why its doing this and how to fix it?hmm the file size changes after its been saved in notepad...Original:Size: 841Size on Disk: 4,096After saved in notepad:Size: 1,052Size on Disk: 4,096 Edited September 10, 2005 by Bi0haZarD Link to comment Share on other sites More sharing options...
Valuater Posted September 10, 2005 Share Posted September 10, 2005 (edited) as a hobbyist, i can only guess that there is an EOF (End Of File) found when read by FileRead() since re-saving creates a larger file (from your edit) maybe try this ventstat.exe 192.168.0.102 > stat1.txt FileCopy(Stat1.txt, Stat.txt) then call your _read() function just an idea 6) Edited September 10, 2005 by Valuater Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 would help if you attached a copy of the file, but sounds like some line feed conversion SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bi0haZarD Posted September 10, 2005 Author Share Posted September 10, 2005 good idea, i didn't think about that. but didn't work unfortunantly Link to comment Share on other sites More sharing options...
Bi0haZarD Posted September 10, 2005 Author Share Posted September 10, 2005 (edited) would help if you attached a copy of the file, but sounds like some line feed conversion<{POST_SNAPBACK}>here it is.http://www.bio.pk-designs.com/ventstat.zipi have commented out the part where it trys to run the "run.cmd".but i'm guessing if you download it and run it then it should should do what its doing over here. it'll read like 15 lines or so then stop. if you open the "stat.txt" file with notepad then save it and hit read it'll read the full text file.only thing i can really think to fix this is to use autoit to open the file in notepad then save it then open it. Edited September 10, 2005 by Bi0haZarD Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 Ok, the file has nul lines it quits reading at the 1st nul line. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bi0haZarD Posted September 10, 2005 Author Share Posted September 10, 2005 Ok, the file has nul lines it quits reading at the 1st nul line.<{POST_SNAPBACK}>how could i get past that? Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 $s_file = _read() ConsoleWrite($s_file) Func _read() Local $stat, $file, $line If FileExists(@ScriptDir & "\stat.txt") Then $file = FileOpen(@ScriptDir & "\stat.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $stat = $stat & $line & @LF WEnd FileClose($file) Return $stat Else SetError(1) Return -1 EndIf EndFunc ;==>_read SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bi0haZarD Posted September 10, 2005 Author Share Posted September 10, 2005 ahh many thanks 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