Click to See Complete Forum and Search --> : How do I Read/Write a structure to a binary file?


Tln1
03-27-2002, 11:23 PM
Ok, It is apparent that FileGet/FilePut are just in VB.NET for compatibility.
Unless you are accessing very small files these functions are useless. So
if you guys are not using the BinaryReader/Writer you will be very disappointed
with file access speeds - got that off my chest.

After playing around with BinaryReader/Writer for several hours, it is definitely
the tool to use for speedy file access but I have hit yet another problem
reading/writing binary files. How do I write or read a structure like this

Public Structure COGO_PT
Dim ID As Byte
Dim PT As Short
<VBFixedArray(20)> Dim DESC() As Byte
Dim NO As Double
Dim EA As Double
Dim EL As Double
End Structure

This has me stumped, any of you have a suggestion or resource?

Regards,
Terry

Steve Cochran
03-28-2002, 05:17 AM
Did you try FileGetObject and FilePutObject?

steve

"Tln1" <tnygaard@flash.net> wrote in message =
news:3ca29aa6$1@10.1.10.29...
>=20
> Ok, It is apparent that FileGet/FilePut are just in VB.NET for =
compatibility.
> Unless you are accessing very small files these functions are useless. =
So
> if you guys are not using the BinaryReader/Writer you will be very =
disappointed
> with file access speeds - got that off my chest.
>=20
> After playing around with BinaryReader/Writer for several hours, it is =
definitely
> the tool to use for speedy file access but I have hit yet another =
problem
> reading/writing binary files. How do I write or read a structure like =
this
>=20
> Public Structure COGO_PT
> Dim ID As Byte
> Dim PT As Short
> <VBFixedArray(20)> Dim DESC() As Byte
> Dim NO As Double
> Dim EA As Double
> Dim EL As Double
> End Structure
>=20
> This has me stumped, any of you have a suggestion or resource?
>=20
> Regards,
> Terry
>

Steve Cochran
03-30-2002, 11:22 PM
more on this. I'm finding that fileputobject works find, but =
filegetobject is very slow (5-10 seconds) with large arrays (e.g. 35 x =
1000).

steve

"Tln1" <tnygaard@flash.net> wrote in message =
news:3ca29aa6$1@10.1.10.29...
>=20
> Ok, It is apparent that FileGet/FilePut are just in VB.NET for =
compatibility.
> Unless you are accessing very small files these functions are useless. =
So
> if you guys are not using the BinaryReader/Writer you will be very =
disappointed
> with file access speeds - got that off my chest.
>=20
> After playing around with BinaryReader/Writer for several hours, it is =
definitely
> the tool to use for speedy file access but I have hit yet another =
problem
> reading/writing binary files. How do I write or read a structure like =
this
>=20
> Public Structure COGO_PT
> Dim ID As Byte
> Dim PT As Short
> <VBFixedArray(20)> Dim DESC() As Byte
> Dim NO As Double
> Dim EA As Double
> Dim EL As Double
> End Structure
>=20
> This has me stumped, any of you have a suggestion or resource?
>=20
> Regards,
> Terry
>