Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedHere 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is corporate culture? Describe the major types.

Answered: 1 week ago

Question

Solve the differential equation. 2ye y2 y' = 2x + 3x

Answered: 1 week ago

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago