I've to run a program sample sample-code.cpp. It is taking a string like -create, 2 file names: one as input input.txt and one as output filename output.idxas parameters and one integer 10.
I should be able to run it from command line (mac Terminal/UNIX) using:
$sample-code -create input.txt output.txt 10
This is a snippet of main() code:
int main(int argc, char* argv[])
{
// Creating New File
if (strcmp(argv[1],"-create") == 0)
{
KeyFieldMax = atoi(argv[2]);
InputFileName = argv[3];
IndexFileName = argv[4];
when I type this command $sample-code -create input.txt output.txt 10 I get this error :
-bash: sample-code: command not found.
KeyFieldMax = atoi(argv[2]);did you miss that in the command lin arguments?getoptor something like it? Argument parsing is surprisingly tricky.$sample-code -create input.txt output.txt 10I get this error :-bash: sample-code: command not found. Maybe the program is not compiled.sample-codewas build to, just type./sample-code.