Question: C program that do these tasks using command line: a program that can access files with some numerical data. The data correspond to a signal
C program that do these tasks using command line:
a program that can access files with some numerical data. The data correspond to a signal that has been sampled. The format of the files is as follows: the first row of the file will have two integers, separated by a space. The first value represents the length of the signal (i.e. the number of sample points). The second value represents the maximum possible value that could have been measured (which may or may not appear in the actual data). Starting at row two, all the way to the end of the file, you have single integer values that correspond to the data samples. consider this example :
5 15
2
11
0
8
13
The program should accept user input from command line arguments. That is, the program wont ask the user to enter the options/parameters during execution, but it will act according to the parameters passed when calling the program. some parameters:
-n: File number (value needed)
-o: offset value (value needed)
-s: scale factor (value needed)
-r: Rename files (name needed)
-h: Help (display how the program should be called, including the different input options)
Offset file example:
5 -2.5
-0.5000
8.5000
-2.5000
5.5000
10.5000
When you call the program : ./My_program s 1.4 n 4 o -2.5 r NewName
the program should read the file Raw_data_04.txt; it should scale the signal by 1.4 (and savethe scaled data into the corresponding file Scaled_data_04.txt); it should offset the original signal by -2.5 (and save it into a file named Offset_data_04.txt,); it should create a copy of the original file and name it NewName.txt.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
