Reading from a Log

Blitz3D Forums/Blitz3D Beginners Area/Reading from a Log

System4 Studios(Posted 2009) [#1]
Ok.. I was wondering if someone can start me off.. say if I had a log that recorded the following usernames from completing events each time.

"down4life" "5/1/2009 11:15 PM" "5617426" "817200" "318374.75"
"~dell~" "5/1/2009 12:11 PM" "8891335" "401400" "123472.24"
"(x-a)vampire" "5/2/2009 12:19 AM" "7269362" "131880" "764124.69"
"~dell~" "5/1/2009 12:15 PM" "5295167" "401400" "123472.24"
"ank-avatar" "5/2/2009 12:19 AM" "5573195" "998000" "272826.209"



As you can see for example.. the user "~dell~" has more than 1 entry in the log..


I want to make a program that shows how many times a person has completed an event based on the number of logged names.. I don't know where to start..



For example.. I want it to show like some kinda of high score system

Log Score:
~dell~ - 2
down4life - 1
ank-avatar - 1


and so forth..


Can some help me..?


lo-tekk(Posted 2009) [#2]
Could be something like this:
logfile=ReadFile("yourlog.file")

name$="~dell~"

While Not Eof(logfile)
	txtLine$=ReadLine(logfile)
	If Instr(txtLine,name)
		nameFound=nameFound+1
	EndIf
Wend



System4 Studios(Posted 2009) [#3]
This method keeps giving the me the "Stream doesn't exist" error and I know it's the right filename..


big10p(Posted 2009) [#4]
Sure the file is in the same folder/directory as your app?


System4 Studios(Posted 2009) [#5]
Yes.. I checked and made sure.. It's still giving me that same error..


Edit.. I figured it out..

The filename is winner_log_.tmc.txt

I had "winner_log_.tmc" in the code..

Thanks.. :)


Only thing now.. is when I test it.. It's outputting that Dell has 1 logged entry and not 2.. like he supposed to have.

I fixed the problem.. and it's dumping all the entries.. :)