problem on logging pedometer data to SD card

hi , my project is stroing the pedometer data into micro SD card as a .csv file with date and time stamps using RTC1307 and i am using arduino mega 2560 kit

i am getting error at serial monitor after one line of logged data as shown in capture

Logging to: LOGGER01.CSV
date, time, tempF,RH%, steps, totalsteps
10/1/2015, 16:44:32, 0, 0
error: write data

please reffer attachment for my code

here i just want steps and total number of steps ( i have connected peopin to analog port A0 only)
so i am not giving any temp, RH% inputs to analog port of arduino (no input to analog ports A1-A5)

Pedometer_RTC.ino (5.92 KB)

Capture.PNG

Looks like someone commented out the opening of the root directory but you are still using 'root':

SdFile root;
void setup(void)
{
  // open root directory
  //if (!root.openRoot(volume)) error("openRoot");

    if (file.open(&root, name, O_CREAT | O_EXCL | O_WRITE)) break;
}

thanks a lot , now i have sloved that volume n card intialisation properly

// initialize a FAT volume
if (!volume.init(&card)) error("volume.init");
if (!sd.begin(SD_CHIP_SELECT, SPI_HALF_SPEED)) sd.initErrorHalt();

// open root directory
if (!root.openRoot(&volume)) error("openRoot");

what "&" do at both commands ?

In both those cases '&' is the 'address of' operator. It returns a pointer to the named variable/object.