Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,577 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,883 people online right now. Registration is fast and FREE... Join Now!




Text Files

 
Reply to this topicStart new topic

Text Files, Scanning for Certain Information in txt files

Wounded
7 Oct, 2008 - 06:23 PM
Post #1

New D.I.C Head
*

Joined: 7 Oct, 2008
Posts: 1

Hey Everyone,

This is my first post here, firstly im not sure if im in the right section, although i do have VB6 its related to getting statistics for a game i play, however the statistics are recorded into a .log file.

this is recorded during every round that is played on a particular server.

i have no VB6 experience at all but i have been browsing the internet like crazy trying to learn and i have some massive big book in it.

What im after is:

everytime a round on the server is finished i want the .log file to be scanner for certain Words on a certain line. the .log file is completely random apart from the line i want to get information from, it has a word on that line that doesnt appear on any other line, so i need to scan the .log file and only pick up the words from that line even tho the particular words will be everywhere in the .log file

i then want it to upload to a databse that accumulates the information as it is gathered from the .log files.

is this easy to do or rather complex??

and if there are any websites of other forums with this sort of information can u please point me in that direction.

i havent had a chance to look through the forum as im at work and dont have much time to go reading.

any help or advice will be greatly appreciated.

Cheers Wounded

PS. if u want to see the log file and the lines i need to get information from please let me know
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Text Files
7 Oct, 2008 - 09:03 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,213



Thanked: 217 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
First of all we can't really do any of the code for you since we have a site policy that states you must show your "best effort" attempt at solving the problem yourself. So it might be wise to grab a book and start from the beginning in programming and get to the point where you can write some code that we can help you with.

However what you are talking about is not overly complex and a great resource on here to help you with what you need to do is a tutorial by born2code which talks about sequential file reading.

Visual Basic Tutorials - File Handling in Visual basic 6 Part 1

You would read in the log file and for each line of the file you read, you would search the words you need. If you find the word on that line, you can extract the content using string functions like Mid, Left, Right and find where to start with Instr().

So a mix of looping through the file, detecting if the words are there using InStr and then using your string functions will help you pull out the content.

As for linking to a database, that is a whole other issue you probably should wait on until you get the file reading and extraction part completed. You will also have code for us to look at and then we can help you further.

Good luck and hope to see you back here soon with the code example. smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:16AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month