473,657 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing array to binary file

tim
i have an array of bytes which i write to a binary file
seems to me the only way is to write one element at a time, which takes *forever

is there a way to write the entire array to the binary file without looping

something like
binarywriter.wr iteEntireArray( arrayOfBytes
would be perfect!
Nov 20 '05 #1
2 1662
On 2004-02-06, tim <an*******@disc ussions.microso ft.com> wrote:
i have an array of bytes which i write to a binary file.
seems to me the only way is to write one element at a time, which takes *forever*

is there a way to write the entire array to the binary file without looping.

something like
binarywriter.wr iteEntireArray( arrayOfBytes)
would be perfect!!


System.IO.Binar yWriter.Write(B yVal Buffer() As Byte)

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
"Mach was the greatest intellectual fraud in the last ten years."
"What about X?"
"I said `intellectual'. "
;login, 9/1990
Nov 20 '05 #2
tim
oh! you're the best, Tom!
thanks
----- Tom Shelton wrote: ----

On 2004-02-06, tim <an*******@disc ussions.microso ft.com> wrote
i have an array of bytes which i write to a binary file
seems to me the only way is to write one element at a time, which takes *forever
is there a way to write the entire array to the binary file without looping
something like

binarywriter.wr iteEntireArray( arrayOfBytes
would be perfect!

System.IO.Binar yWriter.Write(B yVal Buffer() As Byte

--
Tom Shelton [MVP
Powered By Gentoo Linux 1.
"Mach was the greatest intellectual fraud in the last ten years.
"What about X?
"I said `intellectual'.
;login, 9/199

Nov 20 '05 #3

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

Similar topics

6
23591
by: Sebastian Kemi | last post by:
How should a write a class to a file? Would this example work: object *myobject = 0; tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object)); / sebek
4
555
by: Simon | last post by:
Hi all, I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset. The data set can contain 10's of tables, each with 100's of rows, and I have no way of knowing what the tables are, or what they contain. I am currently using the Dataset.WriteXML method passing an XMLWriter.
5
5552
by: rob | last post by:
hey every1, I've got alot of data to write out to file and it's all just 1's and 0's. It's all stored in 2 dimensional arrays of width 32 and varying height. At the moment it's all just integer arrays and the individual 1's and 0's are being written out as integers.
3
2604
by: Trevor.Dhu | last post by:
I am just starting to use python, and as such my question may well be a bit simplistic. I am currently trying to write what should be a very basic set of routines for reading and writing to a binary grid format (ERMapper). However: I am struggling to find the correct tools to write a row of a 2-dimensional array to a binary file. In matlab the command looks like: fid=fopen(filename,'wb');
2
3063
by: Jeevan | last post by:
Hi, I have an array of data (which I am getting from a socket connection). I am working on a program which acts on this data but the program is written to work on data from a file (not from an array). I cannot change anything in the program but can add some features by which I can convert this array of data into a file. The easiest thing would be to write the data into a file (in hard disk) and use it. But I will be working on thousands...
4
5629
by: Jens Mittag | last post by:
Hi! In my code, I have an array of a structure, which I want to save to a binary file. When the array is just created, everything works fine, but when I change contents of the array, saving results in a file, which doesn't hold the information of the changed array anymore. I dont know why. Here is the code: /*
5
3064
by: Speed | last post by:
Hi, I have a 57000 bit long binary number and I want to save it to a file. At the moment I am using an unsigned char array to store the array and then fwrite to store it as follows. fwrite( BinArr, sizeof(unsigned char), 57000, BinFile); But it is a waste of space as this takes up around 57 KB which if I
6
5260
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
5
3805
by: zehra.mb | last post by:
Hi, I had written application for storing employee data in binary file and reading those data from binary file and display it in C language. But I face some issue with writing data to binary file. Here is my part of my code. struct cust_data { int nCAFID; char *szFirstName;
3
11146
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I'm trying to write an array of structures named myStructArray to a binary file and later on read it back. Although I could complete the entire project in C in about 2 minutes, I obviously have my head up and locked when it comes to C#. My first attempt to read such a file was something like: myBinaryReader.ReadBytes(sizeof(myStructArray));
0
8827
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
8504
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
8606
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...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
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
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
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
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
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.