There are five tasks in one assignment. that means, I need five files with C language code. please save them like (stage1.c ~ stage5.c). I provided all the information with one zip file and please...

1 answer below »
There are five tasks in one assignment. that means, I need five files with C language code. please save them like (stage1.c ~ stage5.c). I provided all the information with one zip file and please give me all the explanation each code works.
Answered Same DayAug 07, 2021Macquaire University

Answer To: There are five tasks in one assignment. that means, I need five files with C language code. please...

Arun Shankar answered on Aug 12 2021
142 Votes
#include
#include
#include
#include
#include
struct MyStruct_s{
float hen;
uint16_t bears;
uint64_t fl
ame;
char plane[7];
uint32_t cobweb;
uint32_t seat;
uint8_t cellar;
uint16_t jewel;
char flag;
int16_t page;
double creature;
float things;
int32_t cap;
int64_t guide;
uint8_t committee;
int32_t run;
uint32_t wing;
}MyStruct_default = {-0.000656,1,022,"wren",0,0,0,0,'?',0102,-443951.320312,23.171082,-184,0x19C,38,0xD2,1};
typedef struct MyStruct_s MyStruct;
void usage()
{
fprintf (stderr, "Usage: ./a.out infile outfilen");
fprintf (stderr, "infile is a bin input filen");
fprintf (stderr, "outfile is a bin output filen");
exit(1); // Failure
}
void display(MyStruct s)
{
/*printf("Hen: %f, Bears: %d, Flame: %ju,nPlane: %s, Cobweb: %d, Seat: %d,nCellar: %d, Jewel: %d, Flag: %c,nPage: %d, Creature: %f, Things: %f,nCap: %x, Guide: %li, Committee: %u,nRun: %d, Wing: %dn",s.hen, s.bears, s.flame, s.plane, s.cobweb, s.seat, s.cellar, s.jewel, s.flag, s.page, s.creature, s.things, s.cap, s.guide, s.committee, s.run, s.wing);
printf("n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n"); */
printf("%f, %d, %ju, %s, %d, %d, %d, %d, %c, %d, %f, %f, %x, %li, %u, %d, %dn",s.hen, s.bears, s.flame, s.plane, s.cobweb, s.seat, s.cellar, s.jewel, s.flag, s.page, s.creature, s.things, s.cap, s.guide, s.committee, s.run, s.wing);
}
int main(int argc, char* argv[])
{
if(argc<3)
usage();

FILE* fp = fopen(argv[1],"rb");
if(!fp) // File could not be opened
{
fprintf (stderr, "Could not open file %sn",argv[1]);
exit(1);
}

// Allocate memory...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here