title: How to read an argument in from command line into a double?
body: <p>This program is first forked then run by execlp, it's calling program passes in two numbers, a power and a base. </p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      int pid = getpid();
      printf("Calculator Process[%d]: started\n",pid);
      double base, power;
      sscanf(argv[1],"%d",&amp;base);
      sscanf(argv[2],"%d",&amp;power);
      double number = pow(base,power);
      printf("Calculator Process[%d]: %d ^^ %d == %d\n",pid,base,power,number);
      printf("Calculator Process[%d]: exiting\n",pid);
      return 1;
  }
  </code></pre>
  
  <p>Lets say I pass into it base 3, power 5. This is what I get: </p>
  
  <pre>
  base = 4263 -- this also happens to be the PID. 
  power = -1 
  raised to power: 714477568
  </pre>
  
  <p>Calling line: </p>
  
  <pre><code>execlp("./calculator","./calculator",argv[1],argv[2],(char*)0);
  </code></pre>
  
  <p>When I print the argvs, I get their value (as a char*, but casting fails). </p>
  
  <p>Any ideas why I can't get the values to be correctly read in? </p>