Question
Requirements Write a function that draws a line following coordinates. For this lab, there is no skeleton file provided, so you have to write your
Requirements Write a function that draws a line following coordinates. For this lab, there is no skeleton file provided, so you have to write your main function that interacts with files (descriptions to follow). You are given an input file which contains a set of (x, y) coordinates. These coordinates are written, so that a line segment is connected from the coordinate in the preceding line to the coordinate. For example, lets assume that input.txt contains the following coordinates: >> cat input.txt 0,0 0,1 1,1 1,0 0,0 The first coordinate is at coordinate 0,0 and the next coordinate is at 0,1. There is a line segment of a length 1 from 0,0 to 0,1 in the xy plane. The next line segment moves from 0,1 to 1,1 with a length of 1. This continues until line #5 is processed. In your output file (descriptions to follow), the line segments are represented by a sequence of *s. From the previous input file, the output file will contain the following: >>cat output.txt ** ** Lets take a look at another example where we are drawing a rectangle this time. >> cat input.txt 0,0 0,4 2,4 2,0 0,0 >> cat output.txt *** * * * * * * *** Finally, your input and output can be the following as well. >> cat input.txt 2,2 4,0
0,0 2,2 >> cat output.txt * * * ***** Our program will read an input from a file and write an output to a file. There will not be any output to the console. In order to read/write from/to a file, we need to use file I/O libraries. I am not restricting on what functions you are using as long as they are a part of a standard library mentioned in learning hub. Here (https://www.tutorialspoint.com/cprogramming/c_file_io.htm) is a reference that might be useful to enable this. Detailed specifications are below. 1. The command line argument is in this order
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started