Developer community
0 votes
asked by Guru (39.1k points) 10 23 38 | 31 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) 35 52 113

Related questions

0 votes
0 answers
asked by anonymous | 39 views
0 votes
1 answer
asked by rajesh Guru (39.1k points) 10 23 38 | 30 views
0 votes
1 answer
asked by keem Expert (13.2k points) 29 44 62 | 52 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


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

3.8k questions

4k answers


10.7k users

3,754 questions
4,046 answers
10,709 users