INI files contain data in basic text format
The structure of INI file is the following:
[section1]
key1 = value1
key2 = value2
key3 = value3
; comment
[section2]
key4 = value4
key5 = value5
key6 = value6There are:
-Wall -Wextra flags and fix all
warningsThe program should accept two command line parameters in the format:
$ ./program PATH-TO-INI-FILE.ini section.key
For example:
$ ./program test.ini data.velocityProgram must print out the value of key in the given
section
For the example above, the program has to print out value under
velocity key in [data] section
You can assume the following limits:
fopen() reference and man pagefclose() reference and man pagefgets() reference and man pagefscanf() reference and man pageFailed to find section [data]Failed to find key "velocity" in section [data]struct section { ... };- character)struct
declarationsisalnum() reference
and man pageProgram must distinguish types of values between strings and numbers
Program must be able to understand simple expressions given by the following command line parameters:
$ ./program PATH-TO-INI-FILE.ini expression "distance.velocity * travel.time"The rules for expression evaluation are the following:
+ operator), subtraction
(- operator), multiplication (* operator) and
division (/ operator)+ operator)distance.velocity + text.message is invalid-, * and /
for string type operands is also invalid
e.g. text.hello * text.worldstrcmp() reference
and man pagestrtok() reference
and man pagestrcpy() reference
and man pagestrcat() reference
and man pageWrite a cat-like utility, which opens a file and
prints its content to the terminal
$ cat input.txt
Intelligence forged from circuits and code,
A mind of silicon, a new kind of ode.
$ ./program input.txt
Intelligence forged from circuits and code,
A mind of silicon, a new kind of ode.Write a simple grep-like utility, which opens a file
and prints lines containing a given word
$ cat input.txt
Infinite knowledge at its core,
Capable of so much more,
A creation to marvel and admire,
AI's greatness shall never expire.
$ ./program input.txt admire
A creation to marvel and admire,Write a program, that will read numeric content and calculate sums of each row
$ cat input.txt
58 32 49 22
93 76 68 85
14 25 17 35
42 19 11 70
56 81 37 98
$ ./program input.txt
161
322
91
142
272