hmm.. perhaps I am looking at the wrong implementation,
but the one I see simply parses some string and tries to
fill in the parameters..
What I would like to do is go from file directly to
structure (avoiding as much intermediate buffers as
necessary). For instance, I am using FileStream in
the .NET CF. It allows me to read from file and place the
information into a Byte array.
Let's say I have an array of SYSTEMTIME structures (say
16 bytes each) that I'd like to fill in. I know the file
I'm reading has the exact/correct layout and has 5
SYSTEMTIME structures. Since I see that FileStream only
provides me with functions to read into a byte array, I
create a byte array of length (5*16) and read in all the
data. Is there a way (as John said) to "cast" this byte
array as an array of SYSTEMTIME structures? Or is there
an even better way? Right now it just seems like I have
to create yet another array with the explicit
(SYSTEMTIME) type and manually parse the Byte array, not
only taking time but potentially twice the memory...
Thanks.
-----Original Message-----
Take a look at the SYSTEMTIME class implementation in
OpenNETCF.WinAPI - it
(and several other classes) does exactly what you want.
--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net
Hi,
In my file I store data of known structure types.
Currently I am reading from file, storing into a byte
array, and then do a manual conversion from array to
structure by parsing all the bytes. Is there an easy
way
to just tell C# that some byte array is actually of
structure MyStruct? It just seems like a waste since I
end up w/ two copies of my structure: the final product
and the byte array... Thanks.
+ Stan +
.