I have a C program that has the following:
... misc header code ...
int main(int argc, char *argv[]) {
some_function(argv[3]);
some_other_function(argv[4]);
price = 50.00;
}
Now, I specify a few options as parameters when I run the program like: program "value1" "value2"
I want to be able to specify price, which is a double, via the command line. But argv is already declared as char, so it is giving me problems. How can I take argv[5] and parse it/convert it into a value (double or integer or something) ?
- Jonathan
... misc header code ...
int main(int argc, char *argv[]) {
some_function(argv[3]);
some_other_function(argv[4]);
price = 50.00;
}
Now, I specify a few options as parameters when I run the program like: program "value1" "value2"
I want to be able to specify price, which is a double, via the command line. But argv is already declared as char, so it is giving me problems. How can I take argv[5] and parse it/convert it into a value (double or integer or something) ?
- Jonathan