473,698 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deserializing varying quantity of binary data

Hi All,

I have a binary file, the first few k of which contains some
information which I need to stick in to an array of types,let's call
them Wongas.
Each Wonga is made up of two ulongs and a 24 byte character array.

I need to read in an array of Wongas from the binary file and I need
to specify how many to read in, as the file is only Wongas for the
first few k .What's more, the wongas don't start at the beginning of
the file, they are a few bytes in

In C I could just set the file pointer and then read in a set number
of Wongas in to an array of structures using one read() function.

I am seeing examples of deserializing arrays of Wongas, using the
Deserialize method of the BinaryFormatter , but I don't see a way of
setting the number of wongas retrieved. I get the impression it just
carries on till the end of the file, and as the file is nearly a Giga
byte, that could cause problems.

Any ideas ?

TIA

Kevin R.
Nov 17 '05 #1
1 1315
I think this is the type of info I really needed
http://www.builderau.com.au/architec...0277904,00.htm
On Sat, 02 Jul 2005 18:52:32 +0100, Kevin R <me@privacy.net > wrote:
Hi All,

I have a binary file, the first few k of which contains some
information which I need to stick in to an array of types,let's call
them Wongas.
Each Wonga is made up of two ulongs and a 24 byte character array.

I need to read in an array of Wongas from the binary file and I need
to specify how many to read in, as the file is only Wongas for the
first few k .What's more, the wongas don't start at the beginning of
the file, they are a few bytes in

In C I could just set the file pointer and then read in a set number
of Wongas in to an array of structures using one read() function.

I am seeing examples of deserializing arrays of Wongas, using the
Deserialize method of the BinaryFormatter , but I don't see a way of
setting the number of wongas retrieved. I get the impression it just
carries on till the end of the file, and as the file is nearly a Giga
byte, that could cause problems.

Any ideas ?

TIA

Kevin R.


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7510
by: Wayne Wengert | last post by:
Using VB.NET I want to read in an XML file that has an array of objects and then step through the resulting array in code. I build a class to define the structure and I am running code to read in the data but I can't figure out where the data is in the resulting array. Most of the relevant code is below. When I run the code to desrialize I get no errors but if I try to look at some of the data via the command window I get errors such as...
2
2176
by: Andrew G. J. Fung | last post by:
Can anyone please explain to me why the code below throws an exception? It seems to occur when deserializing an instance of a subclass, whose base class holds a struct, where said struct holds an instance to a reference type (but not System.String). The commented out code are lines that when enabled (and any conflicting lines disabled) stop the exception from being thrown. Thanks kindly, Andrew.
2
3093
by: Earl Teigrob | last post by:
I am saving and restoring value types such as Int32, DateTime and Boolean in strings. I was wondering if there is a mechanism build into .NET for serializing and deserializing these to string format. I can, of course, serialize a class to a file, either binary or XML, but this is not what I am looking for. Currently I am using ToString() or Convert.xxx to do this, but thought that if there was a true serializer, deserializer, that would be...
5
3158
by: Daniel Gackle | last post by:
I'm getting a strange ArgumentNullException after deserializing a SortedList. Haven't seen this discussed in the newsgroups, but it looks like a bug - unless I missed something obvious? I've distilled the problem into the following code. Can anybody reproduce/explain the problem? Thanks, Daniel
2
7969
by: ce | last post by:
Being a newbie regarding serialization and memorystreams, I was trying to see if i could improve page performance (avoiding going to the db on a postback) by saving my serialized business object in viewstate and getting it back from the client on a postback. But the last line of the sample code below throws a "Stream was not readable" error when i'm trying to get the serialized object back out of the viewstate and memorystream. Any...
0
1262
by: Chris Newby | last post by:
Given: public class MyClass{ public String MyPropertyOne; } I have a soap document created by serializing an instance of a previous version of MyClass. However, now MyClass looks like: public class MyClass{
5
2558
by: HandersonVA | last post by:
should I set to "0" as a default value on a quantity and a price field or set to "null"? if a user enter nothing on the quantity or price field on a web browser, should I treat it as null or "0"? I am so confused about this concept. please advise me. thank you.
0
1442
by: S Wheeler | last post by:
Hi All - I am creating a upgrade utility that transfers an bin / exe image over an xml stream. But I can not seem to get the deserialization of the binary field to work correctly. What I have is a base 64 encoded field but when I try to deserialize, I throw an XML / reflection exception. However, if I remove the base64 (m_Data) stuff everything works fine. I clearly have a problem with my m_Data set-up. Does anybody know how to do this?...
7
2823
by: fjlaga | last post by:
I have written an Office Add-in for Excel using VB.NET and the .NET 1.1 Framework (I have Visual Studio 2003 .NET ). All works great. I want to add a User Settings/Prefereneces dialog and allow the user to specify some settings and I need to persist these settings between runs. I made a serializable class which uses the BinaryFormatter to serialize/deserialize the setttings. Serialization works great. However, when I try to...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.