EDN Admin
Well-known member
Hi all i want to ask, I want to create a program that can read and write the data on a file... this file is game music file that contains all information of song, I already know structure and I can read it, I want program only read the level of song (if
song is hard to play, the level is more high), I read the data using File Stream and Binary Reader :
<div style="color:black; background-color:white
<pre> <span style="color:blue Using fs <span style="color:blue As <span style="color:blue New FileStream(OpenFileDialog1.filename, FileMode.Open)
<span style="color:blue Using rdr <span style="color:blue As <span style="color:blue New BinaryReader(fs)
<span style="color:blue Dim seeker <span style="color:blue As <span style="color:blue String = fs.Seek(20, SeekOrigin.Begin)
<span style="color:blue Dim level = rdr.ReadInt16
textbox1.Text = level
fs.Dispose()
fs.Close()
<span style="color:blue End <span style="color:blue Using
<span style="color:blue End <span style="color:blue Using
[/code]
<br/>
But I dont know how to Save data, I only can read it, i cant write data from textbox1 into binary offset 20, this only contain 2 bytes, please tell me the code, sorry if my English so bad, anyway thanks
<br/>
<br/>
View the full article
song is hard to play, the level is more high), I read the data using File Stream and Binary Reader :
<div style="color:black; background-color:white
<pre> <span style="color:blue Using fs <span style="color:blue As <span style="color:blue New FileStream(OpenFileDialog1.filename, FileMode.Open)
<span style="color:blue Using rdr <span style="color:blue As <span style="color:blue New BinaryReader(fs)
<span style="color:blue Dim seeker <span style="color:blue As <span style="color:blue String = fs.Seek(20, SeekOrigin.Begin)
<span style="color:blue Dim level = rdr.ReadInt16
textbox1.Text = level
fs.Dispose()
fs.Close()
<span style="color:blue End <span style="color:blue Using
<span style="color:blue End <span style="color:blue Using
[/code]
<br/>
But I dont know how to Save data, I only can read it, i cant write data from textbox1 into binary offset 20, this only contain 2 bytes, please tell me the code, sorry if my English so bad, anyway thanks
<br/>
<br/>
View the full article