Another stupid question.. [Solved]
Monkey Forums/Monkey Programming/Another stupid question.. [Solved]
| ||
I need to load a log file from outside the build dir. something like this in sudocode myText = LoadFile("C:\Users\paulg\Documents\Logs.txt") Start=myText.Find("thing:") Result:String = myText[start,start+10] Print Result is it even possible for monkey to read outside of the build directory on the installed system ? I took a break from coding and now I have something I wana try I feel like iv forgotten everything I knew. :/ |
| ||
So I did this.... Local file:=FileStream.Open( "C:\Users\paulg\Documents\EVE\logs\Chatlogs\Local_20170114_184945.txt","r" ) If Not file Return Local text:String = CodeToString(file.ReadString("ascii")) file.Close Print text DrawText(text,1,30) End End .... Function CodeToString:String(_data:String) Local Value:String For Local index:Int = 0 To _data.Length If _data[index]=10 Value+="~n" Else If _data[index]>31 And _data[index]<128 Value+=String.FromChar(_data[index]) Endif Endif Next Return Value End Function I would have thought that ReadString would have done the conversion but I guess its left to us.. is there a faster better way of doing this ? I'm not sure how long these log files I am parseing could be its possible some of them might be really long. that being said I only need access to about the first 10 lines of each file I parse. |