Question: Here is what I have so far: void get_ints( char ** argv, unsigned int * input_one, unsigned int * input_two, unsigned long int * output,

Here is what I have so far: void get_ints(char** argv, unsigned int*Here is what I have so far:

void get_ints(char** argv, unsigned int* input_one, unsigned int* input_two,

unsigned long int* output, int num_ints)

{

int i =0;

FILE* file1 = fopen(argv[1], "r");

FILE* file2 = fopen(argv[2], "r");

if (file1 == NULL || file2 == NULL) {

exit(EXIT_FAILURE);

}

fscanf(file1, "%d ", &input_one[i]);

fscanf(file2, "%d ", &input_two[i]);

fclose(file1);

fclose(file2);

}

Please try to implement this function using fgets() instead of fscanf(). Since the largest number is 4294967295, we need 12 characters (including the null character and new line) to read a number from the file

/* This function reads in num_ints integers from the two input files and stores them in input_one (first input file) and input_two (second input file). If one or both of the files do not exist, it should exit with EXIT_FAILURE. input parameters: char** argv unsigned int* input_one unsigned int* input_two int num_ints return parameters: none */ void get_ints (char** argv, unsigned int* input_one, unsigned int* input_two, unsigned long int* output, int num_ints)

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!