Question: HELP WITH THESE TWO FUNCTIONS PLEASE. Write a function that defines a structure, initializes it, writes it to a file called struct.out, closes the file,

 HELP WITH THESE TWO FUNCTIONS PLEASE.  HELP WITH THESE TWO FUNCTIONS PLEASE. Write a function that defines

a structure, initializes it, writes it to a file called "struct.out", closes

Write a function that defines a structure, initializes it, writes it to a file called "struct.out", closes the file, re-opens the file for read-only access, reads a single structure into a new struct variable and then closes the file. Print the structure contents to the screen. On any error, return -1. 0therwise return . Write a function called read_and_print) that will do the following: Open a text file called "hello.txt" for read-only access. Read a word that is terminated by a newline from the file into the character array called "my_string". . Read an integer terminated by a newline into the int variable called "my_int" Print the string and the integer value. . Return the my_int value. If the file cannot be opened for reading, return1 If an error occurs while reading from the file, return -1 Write a function that defines a structure, initializes it, writes it to a file called "struct.out", closes the file, re-opens the file for read-only access, reads a single structure into a new struct variable and then closes the file. Print the structure contents to the screen. On any error, return -1. 0therwise return . Write a function called read_and_print) that will do the following: Open a text file called "hello.txt" for read-only access. Read a word that is terminated by a newline from the file into the character array called "my_string". . Read an integer terminated by a newline into the int variable called "my_int" Print the string and the integer value. . Return the my_int value. If the file cannot be opened for reading, return1 If an error occurs while reading from the file, return -1

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!