473,399 Members | 3,832 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,399 software developers and data experts.

problem of reading a file which contains a structure return in it

hi

i want to write a program that can process a binary file that is being supplied

the file contains some number of the following struct type
Expand|Select|Wrap|Line Numbers
  1. #  define dim 1024
  2. typedef struct
  3. {
  4.   int ival;
  5.   char clist[dim];
  6.   double dval;
  7. }
  8. data_t;
by using this declation i have to write a program that process the file prog1.data

the program must report
the no of data_t structs in the file
the sum of all ival members
the sum of all dval numbers

by making use of cstdlib function
it will be helpful for me

thanks
mano
May 9 '07 #1
3 1222
AdrianH
1,251 Expert 1GB
hi

i want to write a program that can process a binary file that is being supplied

the file contains some number of the following struct type
Expand|Select|Wrap|Line Numbers
  1. #  define dim 1024
  2. typedef struct
  3. {
  4.   int ival;
  5.   char clist[dim];
  6.   double dval;
  7. }
  8. data_t;
by using this declation i have to write a program that process the file prog1.data

the program must report
the no of data_t structs in the file
the sum of all ival members
the sum of all dval numbers

by making use of cstdlib function
it will be helpful for me

thanks
mano
Great, so what have you done so far?


Adrian
May 9 '07 #2
Great, so what have you done so far?


Adrian

i have just started with it

i want the proper direction and steps which i shoud follw
May 9 '07 #3
AdrianH
1,251 Expert 1GB
i have just started with it

i want the proper direction and steps which i shoud follw
Well, we are here to help, but not to do your work.

What do you know that you would think would help in doing this assignment? Tell me that and I will attempt to guide you in your assignment.

Adrian
May 9 '07 #4

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

Similar topics

20
by: ishmael4 | last post by:
hello everyone! i have a problem with reading from binary file. i was googling and searching, but i just cant understand, why isnt this code working. i could use any help. here's the source code:...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
6
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;
12
by: NOO Recursion | last post by:
Hi everyone! I am trying to write a program that will search a 12x12 for a thing called a "blob". A blob in the grid is made up of asterisks. A blob contains at least one asterisk. If an...
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
5
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....
27
by: Jeff | last post by:
Im trying to figure out why I cant read back a binary file correctly. I have the following union: #define BITE_RECORD_LEN 12 typedef union { unsigned char byte; struct { unsigned char type;...
43
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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...

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.