Computers and Technology

I need help writing 3 files, myio. c, driver1.c, and driver2.c. I have provided myio. h down below:Implement the following library and driver programs under assign0:Your library will be consisting of myio. h and myio. c. The function prototypes as well as more explanations are listed in myio. h. Please download it and accordingly implement the exported functions in myio. c. Basically, you are asked to develop a simple I/O library which exports a few functions to simplify the reading of an integer, a double, and more importantly a string (whole line). In contrast to standard I/O functions that can read strings (e. g., scanf with "%s", fgets) into a given static size buffer, your function should read the given input line of characters terminated by a newline character into a dynamically allocated and resized buffer based on the length of the given input line. Also your functions should check for possible errors (e. g., not an integer, not a double, illigal input, no memory etc.) and appropriately handle them. Then write driver programs that can simply use the functions from myio library. Specifically, you will write two driver programs:First one (say driver1.c) gets three command-line arguments: x y z. It then asks user to enter x many integers, y many doubles, and z many lines. Everytime the program prints back the entered data on the stdout while printing error messages on stderr (if any). It also keeps track of the largest integer, double and the longest string. At the end, your program prints the largest intiger, double and the longest line. string that were entered. Second one (say driver2.c) gets two command-line arguments: input_file. txt output_file. txt. Here is a sample input_file. txt , which is a text file containig many lines. Your program reads each line and removes theextra space characters between the words and prints the new line into output_file. txt. So there will be at most one space character between the words in output_file. txt. myio. h :/* * File: myio. h * Version: 1.0 * Last modified on Wed Dec 12 11:37:26 2016 by korkmaz * This is mostly from a similar file provided by eroberts * * This interface provides access to a basic library of * functions that simplify the reading of input data. */#ifndef _myio_h#define _myio_h/* * Function: ReadInteger * Usage: i = ReadInteger(); * * ReadInteger reads a line of text from standard input and scans * it as an integer. The integer value is returned. If an * integer cannot be scanned or if more characters follow the * number, the user is given a chance to retry. */int ReadInteger(void);/* * Function: ReadDouble * Usage: x = ReadDouble(); * * ReadDouble reads a line of text from standard input and scans * it as a double. If the number cannot be scanned or if extra * characters follow after the number ends, the user is given * a chance to reenter the value. */double ReadDouble(void);/* * Function: ReadLine * Usage: s = ReadLine(); * * ReadLine reads a line of text from standard input and returns * the line as a string. The newline character that terminates * the input is not stored as part of the string. */char *ReadLine(void);/* * Function: ReadLine * Usage: s = ReadLine(infile); * * ReadLineFile reads a line of text from the input file which * is already open and pointed by infile. It then reads the line, * dynamically allocates space, and returns the line as a string. * The newline character that terminates the input is not stored * as part of the * string. * The ReadLine function returns NULL if infile is at the * end-of-file position. * Note: the above ReadLine(); can simply be implemented as * { return(ReadLineFile(stdin)); } */char *ReadLineFile(FILE *infile);#endif

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, 1991987
When a rectangular region is defined using an appropriate style, which value matches the specified edge of the clipping region to the edge of the parent element?
Answers: 3
image
Computers and Technology, 22.06.2019 16:50, Tyrant4life
Consider a slotted aloha system, where the time slot equals the fixed duration of each packet. assume that there are 4 stations a, b,c, d sharing the medium. (a) stations a, b,c, d receive one packet each from higher layers at times 1.3, 1.5, 2.6,5.7 respectively. show which transmissions take place when, according to the slottedaloha protocol; describe all transmissions until all four packets have been successful. when needed, each station has access to the following sequence of random number, provided by a random number generator and drawn uniformly between 0 and 1: (1) station a draws numbers: 0.31, 0.27, 0.78, 0.9, 0.9, 0.11, 0. (2) station b draws numbers: 0.45, 0.28, 0.11, 0.83, 0.37, 0.22, 0. (3)station c draws numbers: 0.1, 0.2, 0.3, 0.4, 0. (4) station d draws numbers: 0.36, 0.77, 0.9, 0.1, 0.1, 0.1, 0.1, 0. (b) in slotted aloha, a station transmits in each time slot with a given probability. what probabilities would you assign to each of the four stations so as to: (i) maximize the efficiency of the protocol? (ii) maximize fairness among the four stations? (c) will the efficiency increase or decrease if we modify slotted aloha as follows: (i) get rid of slots and allow stations to transmit immediately? (ii) implement carrier sensing? (iii) implement collision detection? (iv) implement collision avoidance?
Answers: 3
image
Computers and Technology, 22.06.2019 19:10, hgdthbgjnb83661
What a backup plan that you have created in a event you encounter a situation
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, magicalunicorns47
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
Do you know the correct answer?
I need help writing 3 files, myio. c, driver1.c, and driver2.c. I have provided myio. h down below:I...

Questions in other subjects:

Konu
Biology, 02.09.2020 06:01