Developer community
0 votes
29 views
asked by Guru (39.1k points) 10 22 35 | 29 views

1 Answer

0 votes
To write out a structure we can use fwrite() as Fwrite( &e, sizeof(e),1,fp);Where e is a structure variable. A corresponding fread() invocation can read the structure back from file. calling fwrite() it writes out sizeof(e) bytes from the address &e. Data files written as memory images with fwrite(),however ,will not be portable, particularly if they contain floating point fields or Pointers. This is because memory layout of structures is machine and compiler

dependent. Therefore, structures written as memory images cannot necessarily be read back by programs running on other machine, and this is the important concern if the data files you’re writing will ever be interchanged between machines.
answered by Guru (27.1k points) 33 50 100

Related questions

0 votes
0 answers
asked by anonymous | 38 views
0 votes
1 answer
asked by rajesh Guru (39.1k points) 10 22 35 | 29 views
0 votes
1 answer
asked by keem Expert (13.2k points) 27 43 59 | 49 views
0 votes
1 answer
0 votes
1 answer
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users