SD writer code ultra light

I wrote a small library for Standard SD cards, 2 GB or less, formatted FAT16. The library is here Google Code Archive - Long-term storage for Google Code Project Hosting..

The total size of this sketch is 7126 bytes on an Uno with Arduino 1.02.

#include <Fat16.h>
SdCard card;
Fat16 file;

void setup() {
  Serial.begin(9600); 
  if (!card.init() || 
    !Fat16::init(&card) ||
    !file.open("MYFILE.TXT", O_APPEND | O_CREAT | O_WRITE)) {
    Serial.println("init failed");
    while(1);
  }
  file.println("append 1, 2, 3");
  file.close();
  Serial.println("Done");
}
void loop() {}

It should add less than 7 KB to your sketch since the following sketch take 1928 bytes.

void setup() {
  Serial.begin(9600);
  Serial.println("Done");
}
void loop() {}