Results 1 to 2 of 2

Thread: .net has random files?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6

    Unhappy .net has random files?

    I all!

    I wonder how can I translate the following, simply, code to Vb.NET (and/or
    C#), possibly using just the .NET framework functions instead of the Visual
    Basic Run-Time Functions (e.g. FileOpen) implemented only for compatibility:

    Type MyType2
    Values(10) as byte
    End Type

    Type MyType
    Dt As Date
    Typs(10) As MyType2
    End type

    Dim x() As MyType
    Redim x(0 to 50)

    ' write a whole file
    Open "dummy.dat" For Binary As 1
    Put 1, 1, x()
    Close 1

    ' update the #10 item
    Open "dummy.dat" For Binary As 1
    Put 1, 10, x(9)
    Close 1

    And then read the values:

    ' read the whole file...
    Open "dummy.dat" For Binary As 1
    Put 1, 1, x()
    Close 1

    ' ...or just one element
    Open "dummy.dat" For Binary As 1
    Put 1, 10, x(9)
    Close 1

    I would not think that .NET has no structured binary/random-file
    capability!
    And if it is... how can I obtain something similar (I need speed accessing
    disk and I don't want DB-engines)?

    Thank you!

  2. #2
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Use the FileSystem namespace. That ought to provide you with everything you need.
    Please rate my post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width