There shouldn't be anything special beyond what you're doing. Here's a
console app that writes out about 4MB using the same technique.
Imports System.IO
Module Module1
Sub Main()
Dim data As String = "0123456789012345678901234567890123456789"
Dim filename As String = System.Environment.CurrentDirectory() &
"\msec.dat"
Dim fs As Stream = File.Open(filename, FileMode.Create,
FileAccess.Write)
Dim b As New BinaryWriter(fs)
For i As Integer = 1 To 100000
b.Write(data)
Next
b.Close()
fs.Close()
End Sub
End Module
"ThunderMusic" wrote:
> hi,
> no, I'm not writing just 1 value... the "TheValueToWrite" was just a name I
> put there because it could be almost any base type : string, bit, byte,
> int16, int32, int64, et al. I go through many steps and would have to write
> from 2k to about 500k (I don't think it will go higher than that, but it
> could).
>
> For now, I write almost just strings, int32 and booleans but it could be
> anything...
>
> thanks
>
> ThunderMusic
>
> "Scott Swigart" <(E-Mail Removed)> a écrit dans le message de
> news:26290343-F122-4206-A26D-(E-Mail Removed)...
> > What's "TheValueToWrite" defined as? Are you just writing one value?
> >
> > Scott Swigart
> > VB - MVP
> >
> > "ThunderMusic" wrote:
> >
> > > Hi,
> > > In my app, I open a file using a FileStream then pass it to a
> > > BinaryWriter. I then use the BinaryWriter instance to write to my file.
> But
> > > a problem arose : The file never gets bigger than 1kb. The code calls
> the
> > > bw.write(TheValue), but nothing is written after 1kb. I'm I missing
> > > something?
> > >
> > > Here's the way I create my FileStream and BinaryWriter :
> > >
> > > Filename = System.Environment.CurrentDirectory() & "\msec.dat"
> > > fs = System.IO.File.OpenWrite(Filename)
> > > bw = New System.IO.BinaryWriter(fs)
> > >
> > > When I write I do:
> > >
> > > bw.write(TheValueToWrite)
> > >
> > > And when done writing, I do :
> > >
> > > bw.close
> > > fs.close
> > >
> > > Am I missing something?
> > >
> > > Thanks
> > >
> > > ThunderMusic
> > >
> > >
> > >
>
>
>
|