Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write out the file contents for out2 as produced by the following code. Give specific values to bytes or ranges of bytes. The values of

Write out the file contents for out2 as produced by the following code. Give specific values to bytes or ranges of bytes. The values of the same variable are being written using fprintf() and then fwrite(). How many bytes are written by each, and which is more efficient?

#include main() {

FILE *fpt;

struct frog {

float d;

int x; }

henry;

henry.d=12.73;

henry.x=81925;

fpt=fopen("out2","w");

fprintf(fpt,"%7.2f %7d ",henry.d,henry.x);

fwrite(&henry,sizeof(struct frog),1,fpt);

fclose(fpt); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions