Read text from .dat file?

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
16 posts Page 2 of 2
Contributors
User avatar
DarkyKnife
Top Poster
Top Poster
Posts: 109
Joined: Thu Apr 29, 2010 4:59 pm

Re: Read text from .dat file?
DarkyKnife
Agust1337 wrote:
Hello DarkyKnife,
I haven't tried this code, but here:
Code: Select all
 Dim fInfo As New FileInfo("servercache.dat")
        Dim numBytes As Long = fInfo.Length
        Dim fStream As New FileStream("servercache.dat", FileMode.Open, FileAccess.Read)
        Dim br As New BinaryReader(fStream)
        Dim data As Char() = br.ReadChars(CInt(numBytes))
        'Dim data As Byte() = br.ReadBytes(CInt(numBytes))
        Dim test As String = ""
        For i = 0 To 5000
            test += Convert.ToString(data(i))
        Next
        MsgBox(test)
 
        br.Close()
        fStream.Close()
Hi August, the code is not working, i get error while running program in line
Code: Select all
 test += Convert.ToString(data(i)) 

and it says
Code: Select all
 Index was outside the bounds of the array. 
Visit my Youtube chanel
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Read text from .dat file?
Agust1337
Hmm Okay, try opening it in the debug folder not through vb.
Top-notch casual Dating
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Read text from .dat file?
mandai
This minecraft game may use a specific format for stored text, if thats the case you will have to figure out the file structure.

You could search through the file to match patterns of unicode/ASCII text if that is what you are after.
User avatar
DarkyKnife
Top Poster
Top Poster
Posts: 109
Joined: Thu Apr 29, 2010 4:59 pm

Re: Read text from .dat file?
DarkyKnife
Agust1337 wrote:
Hmm Okay, try opening it in the debug folder not through vb.
I get the same message when i open not in VB
Visit my Youtube chanel
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: Read text from .dat file?
Codex
You need to change the 5000 to the length of the file(characters).
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Read text from .dat file?
GoodGuy17
mandai wrote:
This minecraft game may use a specific format for stored text, if thats the case you will have to figure out the file structure.

You could search through the file to match patterns of unicode/ASCII text if that is what you are after.
Mandai, check these links:
http://www.minecraft.net/docs/levelformat.jsp
http://www.minecraft.net/docs/NBT.txt
Hope it helped!
Last bumped by GoodGuy17 on Thu Jan 20, 2011 12:29 am.
16 posts Page 2 of 2
Return to “Tutorial Requests”