Correct array type and SDFat saving.

Here is a minimal sketch to show the only way I understand to save my values to SDcard. For this example, I am saving the defined values rather than showing the 500 lines of code it takes to update the values. Keep in mind I will have 25 changing values, (rather than 9) in my final sketch.

Is there a better way to write to the card? I would like to use a for loop instead of the redundant write and print statements.

#include <SdFat.h>

// file system
SdFat sd;

// log file
SdFile file;

// store error strings in flash to save RAM
#define error(s) sd.errorHalt_P(PSTR(s))
///////////////////////variables////////////////////////////
int RPM = 999;                //variable for RPM reading
int Throttle = 0;             //Throttle postion
float Battery  = 0.00;        //battery voltage
int Gear = 0;                 //gear position
int Advance = 0;              //ignition advance
float AF = 0.00;              //air fuel ratio
int IAP = 0;                  //value for map
int CLT = 0;                  //Coolant temp
int stp = 0;                  //secondary throttle postiton
//------------------------------------------------------------------------------
void setup(void) {
  Serial.begin(9600);

  // breadboards.  use SPI_FULL_SPEED for better performance.
  if (!sd.init(SPI_FULL_SPEED)) sd.initErrorHalt();

  // create a new file
  char name[] = "LOGGER00.CSV";
  for (uint8_t i = 0; i < 100; i++) {
    name[6] = i/10 + '0';
    name[7] = i%10 + '0';
    if (file.open(name, O_CREAT | O_EXCL | O_WRITE)) break;
  }

  if (!file.isOpen()) error ("file.create");

  // write header
  file.writeError = 0;
  file.print("millis");
  file.println();  

  if (file.writeError || !file.sync()) {
    error("write header failed");
  }
}
//------------------------------------------------------------------------------
void loop(void) {
  uint32_t m;

  m = millis();

  // log time
  file.print(m);  

  // add sensor data 
  file.write(',');
  file.print(RPM);
  file.write(',');
  file.print(Throttle);
  file.write(',');
  file.print(Battery);
  file.write(',');
  file.print(Gear);
  file.write(',');
  file.print(Advance);
  file.write(',');
  file.print(AF);
  file.write(',');
  file.print(IAP);
  file.write(',');
  file.print(CLT);
  file.write(',');
  file.print(stp);

  file.println();  

  if (file.writeError) error("write data failed");

  if (!file.sync()) error("sync failed");
}