473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to write a c++ program that processes the integer values stored in a binary file?

Hi All,

I don't want to use the struct structure to access or represent the elements, I just want to save integer values to a binary file (now I have the data stored on a text file and the first line in it represent the dimensions of the matrix) and then access them and store them in a 1D array.

for which the integer values are representable in reality by a 2D matrix but i will store them on a binary file, and I am going to copy them from the binary file and store them in a 1D array to access them as if they were 2D.

sorry I don't have code now ... but I am confused how to start!

Regards
May 12 '11 #1
2 2381
horace1
1,510 Expert 1GB
have a look at the section on Binray IO in
http://www.cplusplus.com/doc/tutorial/files/

also
http://www.codingunit.com/c-tutorial-binary-file-io
May 12 '11 #2
Thank you horace1 very much for the links :)
May 13 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Enrico Morelli | last post by:
Dear all, I have to write a program which reads from a binary file, a serious of 32 bit long integer data and stores its in an array. I cannot know the format (little or big endian) and I have...
4
by: nightflyer | last post by:
Hi all, [code snippet appended at the end.) my question: A class has a few string variables with not know length at design time. Now I declare lets say a 1000 of those classes and put them...
3
by: simon lee | last post by:
Dear all, I use VC++ to write a program for display a flash file "file.fla", However, for displaying flash file, it sometimes become black screen and sometimes cannot display the corresponding...
5
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...
0
by: Bahaa Hany | last post by:
that the code i wrote FileStream w = new FileStream("d:\\HufmanCompression.txt",FileMode.Create); BinaryWriter writer = new BinaryWriter(w); for (i = 0; i <...
2
by: Rupali12345 | last post by:
hi all, In following code itemdescription value is stored properly in file but the float values are stored as different symbols such as @,@A etc. If i want to store float values also as it...
4
by: Bonzol | last post by:
Hello!, I'm just trying to write my string to a simple binary file so it can't be read in a text document,, however it doesn't work.. I do this FileStream fs =...
1
by: apryladams | last post by:
i need to display 25 numbers in 5 output lines -5 numbers per line calculate sum and average those 25 vnumbers display sum and avergae on page output sum and average into an output file. find...
7
by: Ludo | last post by:
Hi, I'm working on an open source project and I have a problem with a binary file. When I read the binary file with the program downloaded from sourceforge, I have no problem. However, I'm unable...
1
by: KWSW | last post by:
Got a question about reading and writing binary files. I know that to write a value(integer) to a binary file I can use the fileoutputstream to do it. try { // Create an output...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.