Write a program that is passed a file name and a string to be searched through command-line arguments code example
Example 1: check command line input is a number in c
bool isNumber(char number[])
{
int i = 0;
//checking for negative numbers
if (number[0] == '-')
i = 1;
for (; number[i] != 0; i++)
{
//if (number[i] > '9' || number[i] < '0')
if (!isdigit(number[i]))
return false;
}
return true;
}
Example 2: get input from command line and run command in c++
> args my_file.txt
Line fab
Line fab
Line edc