title: Trying to copy "0.75" as a double from argv[]
body: <p>For some reason anything I try results in numbers after the decimal place being disregarded.</p>
  
  <p><code>sscanf(argv[5], "%.2lf", &amp;add4);</code> doesn't work</p>
  
  <p><code>add4 = atof(argv[5]);</code> doesn't work</p>
  
  <p>Any help?<br>
  1: program name (aka for the program im trying to solve currently, i need the following parameters. of these, double isnt getting saved properly)<br>
  2: string<br>
  3: int<br>
  4: int<br>
  5: double  </p>
  
  <p>all but the double are being copied into my arrays fine. I've tried the above two ways of copying the double but both result in numbers after the decimal being .00</p>
  
  <p>Declarations:<br>
  <code>char add1[50];
  int add2, add3;
  double add4;</code></p>
  
  <p>This call adds a new line to a list .csv file:</p>
  
  <p><code>inv add banana 2 2 2.50</code></p>
  
  <p>where below, <code>command</code> has already been assigned the string "add".</p>
  
  <p>what would end up listed would be:</p>
  
  <p>"banana, 2, 2, 2.00" at the end of my text file</p>
  
  <pre><code>if(strcmp(command,"add") == 0)
                  {
                      strcpy(add1, argv[2]);
                      add2 = atoi(argv[3]);
                      add3 = atoi(argv[4]);
                      add4 = atof(argv[5]);
  
                      FILE *fp3 = fopen("replica.csv", "w");
                      for(j=0;j&lt;i;j++)
                      {
                          fprintf (fp3, "%s,%d,%d,%.2lf\n", item[j], quantity[j], limit[j], cost[j]);
                      }   
  
                      fprintf(fp3, "%s,%d,%d,%.2lf\n", add1, add2, add3, add4);
  
                      fclose(fp1);
                      fclose(fp3);
                      remove("inventory.csv");
                      rename("replica.csv", "inventory.csv"); 
                  }
  </code></pre>