This example doesn't work

Hi there!

I’m trying to compile this example but it doesn’t work… can anyone help me?

/*
Basic example reading and writing to the microSD shield
Based on the SdFat Library by Bill Greiman
SparkFun Electronics

This example creates a file (or opens it if the file already exists) named ‘Test.txt.’
A string with the value ‘Millis: (number of millis)’ is appended to the end of the file.
After writing to the file, the contents of the entire file are printed to the serial port.
*/

//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
#include <ctype.h>

//Create the variables to be used by SdFat Library
Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

char name = “Test.txt”; //Create an array that contains the name of our file.
char contents[256]; //This will be a data buffer for writing contents to the file.
char in_char=0;
int index=0; //Index will keep track of our position within the contents buffer.

void setup(void)
{
Serial.begin(9600); //Start a serial connection.
pinMode(10, OUTPUT); //Pin 10 must be set as an output for the SD communication to work.
card.init(); //Initialize the SD card and configure the I/O pins.
volume.init(card); //Initialize a volume on the SD card.
root.openRoot(volume); //Open the root directory in the volume.
}
void loop(void){
file.open(root, name, O_CREAT | O_APPEND | O_WRITE); //Open or create the file ‘name’ in ‘root’ for writing to the end of the file.
sprintf(contents, "Millis: %d ", millis()); //Copy the letters 'Millis: ’ followed by the integer value of the millis() function into the ‘contents’ array.
file.print(contents); //Write the ‘contents’ array to the end of the file.
file.close(); //Close the file.

file.open(root, name, O_READ); //Open the file in read mode.
in_char=file.read(); //Get the first byte in the file.
//Keep reading characters from the file until we get an error or reach the end of the file. (This will output the entire contents of the file).
while(in_char >=0){ //If the value of the character is less than 0 we’ve reached the end of the file.
Serial.print(in_char); //Print the current character
in_char=file.read(); //Get the next character
}
file.close(); //Close the file
delay(1000); //Wait 1 second before repeating the process.
}

ERROR

sketch_sep26a.ino: In function ‘void setup()’:
sketch_sep26a:32: error: no matching function for call to ‘SdVolume::init(Sd2Card&)’
C:\Users\PACO\Desktop\arduino-1.0.4\libraries\SdFat/SdVolume.h:81: note: candidates are: bool SdVolume::init(Sd2Card*)
C:\Users\PACO\Desktop\arduino-1.0.4\libraries\SdFat/SdVolume.h:82: note: bool SdVolume::init(Sd2Card*, uint8_t)

I had similar issues with some of my older programs when I upgraded the library to “sdfatlib20130629”.

Those functions have changed in the new library. The new functions return boolean. Check the new docs located in library directory under “html”.

this link might help too.
http://www.ladyada.net/learn/arduino/ethfiles.html

Maybe this will help. Warning Compiles, but untested.

/*
    Basic example reading and writing to the microSD shield
 Based on the SdFat Library by Bill Greiman
 SparkFun Electronics
 
 This example creates a file (or opens it if the file already exists) named 'Test.txt.'
 A string with the value 'Millis: (number of millis)' is appended to the end of the file.
 After writing to the file, the contents of the entire file are printed to the serial port.
 */

//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
#include <ctype.h>

//Create the variables to be used by SdFat Library
Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

#define SD_CHIP_SELECT  10 // Your select pin (4 on ethernet shield)

char name[] = "Test.txt";     //Create an array that contains the name of our file.
char contents[256];           //This will be a data buffer for writing contents to the file.
char in_char=0;
int index=0;                  //Index will keep track of our position within the contents buffer.

void setup(void)
{ 
  Serial.begin(9600);        //Start a serial connection.
  
  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  if (!card.init(SPI_HALF_SPEED, SD_CHIP_SELECT)) Serial.println("card.init failed!");
  
  // initialize a FAT volume
  if (!volume.init(&card)) Serial.println("vol.init failed!");
  
  //Initialize a volume on the SD card.
  if (!root.openRoot(&volume)) Serial.println("openRoot failed");
  
  //volume.init(card);         //Initialize a volume on the SD card.
  //root.openRoot(volume);     //Open the root directory in the volume.
}
void loop(void){   
  file.open(&root, name, O_CREAT | O_APPEND | O_WRITE);    //Open or create the file 'name' in 'root' for writing to the end of the file.
  sprintf(contents, "Millis: %d    ", millis());    //Copy the letters 'Millis: ' followed by the integer value of the millis() function into the 'contents' array.
  file.print(contents);    //Write the 'contents' array to the end of the file.
  file.close();            //Close the file.

  file.open(&root, name, O_READ);    //Open the file in read mode.
  in_char=file.read();              //Get the first byte in the file.
  //Keep reading characters from the file until we get an error or reach the end of the file. (This will output the entire contents of the file).
  while(in_char >=0){            //If the value of the character is less than 0 we've reached the end of the file.
    Serial.print(in_char);    //Print the current character
    in_char=file.read();      //Get the next character
  }
  file.close();    //Close the file
  delay(1000);     //Wait 1 second before repeating the process.
}

Thanks so much... it's been helpful. Problem solved!