C++ Question

Started by
2 comments, last by pigsfl3w 22 years, 2 months ago
I am trying to get numbers from the command line as arguments. Just to try it out I did something like: int main(int argc, char* argv[]) { int a = (int) argv[1]; int b = (int) argv[2]; int c = a + b; //etc... } Only problem is, this didn''t work. Any suggestions how to do this? The usage is something like ''program . Thank You, pigsfl3w
Advertisement
Try this ...
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int c = a + b;
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
What header file is atoi() in?
#include <stdio.h>

This topic is closed to new replies.

Advertisement