0

I need to make a program, ioloop.c, which takes two command line parameters that determine the number of iterations of two nested for loops. The inner loop performs a more time-consuming function, such as a trig function. The outer loop first takes a character from stdin, then outputs some number of characters after the inner loop.

My issue has been finding adequate resources on the internet about Minix 3. I haven't found any good tutorials yet that explain the process of implementing a command line method. My first assumption would be that it has something to do with the exec system call.

Any help or explanation on which Minix 3 files are used to implement command line functions would be awesome.

1 Answer 1

1

You can use arguments in main function of program

(...)
int main(int artc, char argv[3]){
 int n1 = atoi(argv[1]);
 int n2 = atoi(argv[2]);
(...)

Where n1 and n2 are command line parameters. Then if You call

./a.out 100 2000

n1 will be set to 100 and n2 will be 2000

Sign up to request clarification or add additional context in comments.

2 Comments

I tried it, and on the line "int main(int artc, char[] argv)" I got an error: "expected ';' , ',' or ')' before 'argv' when I tried to compile.
That didn't work either, lol, but I figured it out. The correct syntax was: int main(int artc, char **argv)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.