Question: C programming Please notice the intended output and the original question are a little different. Specifically choice number 1. Here is the code I made

C programming Please notice the intended output and the original question are a little different. Specifically choice number 1.

C programming Please notice the intended output and the original question are

a little different. Specifically choice number 1. Here is the code I Here is the code I made to initialize the .dat file

// Creating a random-access file sequentially

#include

// item structure definition

struct item {

int number;

char name[10];

int quantity;

float cost;

};

// begin main function

int main(){

int i;

FILE *cfPtr;

// fopen opens the file; exits if file cannot be opened

if(( cfPtr = fopen("hardware.dat", "wb")) == NULL){

puts("File could not be opened.");

}

else{

// create clientData with default information

struct item createEmptyRecord = {0, "", 0, 0.0};

for (i=1;i

//the fwrite function in the stdio.h library

//declartion size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)

fwrite (&createEmptyRecord, sizeof (struct item), 1, cfPtr);

} // end for loop

}

fclose(cfPtr);

} // end main function

Your choices are 1 - STORE a formatted text file of inventoried tools called choices are hardware.txt for printing UPDATE a tool record - ADD a new tool record 4DELETE a tool record - DISPLAY a tool record END program Selection: Your choices are 1 - STORE a formatted text file of inventoried tools called choices are hardware.txt for printing UPDATE a tool record - ADD a new tool record 4DELETE a tool record - DISPLAY a tool record END program Selection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!