Question: Write the definition of a C function named sortSets that does the following: The caller passes two strings as arguments. The first string is the

Write the definition of a C function named sortSets that does the following:
The caller passes two strings as arguments. The first string is the name of the file that contains data.
The second string is the name of the file for writing the output.
The data file contains only integer values. Each line (ending with carriage return) contains an unspecified number of integers, which we will call a set. The size of a particular set is not known in advance, but each set will contain at least one integer and will not contain more than 25 integers. Each integer on the line will be followed either by a single space or a linefeed. The number of lines is unknown and unlimited. (There will be at least one set; the data file will not be empty.)
The function must read the information from the data file and must write a new file in which each set is sorted from smallest to largest value. Each set must be written as a single line (ending with carriage return) in the output file. In other words, the format of the output file is the same as the input file -- one set per line. You must call the sort function from part (a) to sort the values.
The function returns 1 if both files are successfully opened and processed, and returns 0 otherwise.
You may use any C standard library functions from the Reference Sheet. Do not use #include in your answer; assume that is done elsewhere in the code. You are allowed to write additional functions, if desired (but all functions must be declared/defined before they are called). NOTE: The fgets function is NOT on the Reference Sheet.
Additional space is provided on the following page.

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 Programming Questions!