Skip to content

Commit dcaf74b

Browse files
committed
add an example for commandline arguments
Add a file demonstrating how to get and use commandline arguments. This is useful in systemc as it can be used to configure a simulation session, making the implementation more generic.
1 parent a21f6f4 commit dcaf74b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test_argv.cc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include<iostream>
2+
#include<cstdlib>
3+
4+
using namespace std;
5+
6+
int main(int argc, char* argv[]){
7+
int a=0;
8+
cout<<"value of argc: "<<argc<<"\n";
9+
cout<<"the value of argv[0]: "<<argv[0]<<"\n";
10+
cout<<"the value of argv[1]: "<<argv[1]<<"\n";
11+
a=atoi(argv[1]);
12+
return 0;
13+
}

0 commit comments

Comments
 (0)