user41186: I have been searching everywhere now and nothing seems to work out for me. When I try to input a new word, it overlaps the previously entered words.
Here is my struct definition: 
struct LogEvent{
  char fullname[30];  
} logEvent;

Here is how I assign a value to fullname:  
strcpy(logEvent.fullname, testName);  

Here is how I print the output:
for(int i = 0; i <= db.count(); i++)
{
  EDB_Status result = db.readRec(i, EDB_REC logEvent);
  if(result == EDB_OK)
  {
     Serial.print(logEvent.fullname);
     Serial.print(" ");
  }
} 

Here is the sample output:  
Input 1 - Lebron James  
Output 1- Lebron James

Input 2 - Kobe Bryant
Output 2 - Kobe Bryant Kobe Bryant  (The output should be - Lebron James Kobe Bryant)

Input 3 - LeGoat 
Output 3 - LeGoat LeGoat LeGoat (The output should be - Lebron James Kobe Bryant LeGoat)  

How to fix this? 
EDIT. Here is my code:  
#include "Arduino.h"
#include <EDB.h>

// Use the external SPI SD card as storage
#include <SPI.h>  
#include <SD.h>

int recnumber = 1;  
//Arbitrary definition
struct LogEvent {
    int id;
    int temperature;
    char fullname[30];
}
logEvent;  


inline void writer (unsigned long address, const byte* data, unsigned int  recsize) {
    digitalWrite(13, HIGH);
    dbFile.seek(address);
    dbFile.write(data,recsize);
    dbFile.flush();
    digitalWrite(13, LOW);
}

inline void reader (unsigned long address, byte* data, unsigned int recsize) {
   digitalWrite(13, HIGH);
   dbFile.seek(address);
   dbFile.read(data,recsize);
   digitalWrite(13, LOW);
}  
  EDB db(&writer, &reader);

// Run the demo
void setup()
{
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);

    Serial.begin(9600);
    Serial.println(" Extended Database Library + External SD CARD storage demo");
    Serial.println();

    randomSeed(analogRead(0));

    if (!SD.begin(SD_PIN)) {
        Serial.println("No SD-card.");
        return;
    }

    // Check dir for db files
    if (!SD.exists("/db")) {
        Serial.println("Dir for Db files does not exist, creating...");
        SD.mkdir("/db");
    }

    if (SD.exists(db_name)) {

        dbFile = SD.open(db_name, FILE_WRITE);

      // Sometimes it wont open at first attempt, espessialy after cold start
      // Let's try one more time
        if (!dbFile) {
            dbFile = SD.open(db_name, FILE_WRITE);
        }

        if (dbFile) {
            Serial.print("Openning current table... ");
            EDB_Status result = db.open(0);
            if (result == EDB_OK) {
                Serial.println("DONE");
            } else {
                Serial.println("ERROR");
                Serial.println("Did not find database in the file " + String(db_name));
                Serial.print("Creating new table... ");
                db.create(0, TABLE_SIZE, (unsigned int)sizeof(logEvent));
                Serial.println("DONE");
                return;
            }
        } else {
            Serial.println("Could not open file " + String(db_name));
            return;
        }
    } else {
        Serial.print("Creating table... ");
        // create table at with starting address 0
        dbFile = SD.open(db_name, FILE_WRITE);
        db.create(0, TABLE_SIZE, (unsigned int)sizeof(logEvent));
        Serial.println("DONE");
    }
    deleteAll();
    recordLimit();
    countRecords();  
}
char testName[30];   

void loop()
{
  if(Serial.available())
  {
    Serial.println("Waiting for name...");
    index = 0;
    for(int i = 0; i < sizeof(testName); ++i)
    {
      testName[i] = (char)0;
    }
    while(Serial.available())
    {
      char character = Serial.read();
      testName[index] = character;
      index++;
    }
    createRecords(testName);
    selectAll();
    delay(1000);
  } 
  delay(1000);
 }  

void createRecords(char *testName)
{
  Serial.print("Creating Record... ");
  logEvent.id = recnumber;
  logEvent.temperature = random(1, 125);
  strcpy(logEvent.fullname, testName);
  recnumber++;
  EDB_Status result = db.appendRec(EDB_REC logEvent);
}

void selectAll()
{
   for (int recno = 1; recno <= db.count(); recno++)
   {
      EDB_Status result = db.readRec(recno, EDB_REC logEvent);
      if (result == EDB_OK)
      {
        Serial.print("Recno: ");
        Serial.print(recno);
        Serial.print(" ID: ");
        Serial.print(logEvent.id);
        Serial.print(" Temp: ");
        Serial.print(logEvent.temperature);
        Serial.print(" Fullname: ");
        Serial.print(logEvent.fullname);
        Serial.print(" Length: ");
        Serial.println(strlen(logEvent.fullname));
      }
    }
 }  

Here is the output:  
Extended Database Library + External SD CARD storage demo

Openning current table... DONE
Truncating table... DONE
Record Limit: 2045
Record Count: 0
Record Count: 0
Waiting for name...
Name received: Kobe Bryant
LogEvent Fullname: 
The sentence entered is 11 characters long
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Kobe Bryant Length: 11
Waiting for name...
Name received: Lebron James
LogEvent Fullname: Kobe Bryant
The sentence entered is 12 characters long
Recno: 1 ID: 1 Temp: 64 Fullname: Kobe Bryant Length: 11
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Lebron James Length: 12
Recno: 2 ID: 2 Temp: 78 Fullname: Lebron James Length: 12
Waiting for name...
Name received: Michael Jordan
LogEvent Fullname: Lebron James
The sentence entered is 14 characters long
Recno: 1 ID: 1 Temp: 64 Fullname: Lebron James Length: 12
Recno: 2 ID: 2 Temp: 78 Fullname: Lebron James Length: 12
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Michael Jordan Length: 14
Recno: 2 ID: 2 Temp: 78 Fullname: Michael Jordan Length: 14
Recno: 3 ID: 3 Temp: 29 Fullname: Michael Jordan Length: 14  

Update: I tried to use memset but the result is still the same as above.

user41186: I managed to solve the problem. The problem is with the SD card library of Arduino. I downloaded this library sdFat library, included it in the sketch #include "SdFat.h", and defined SdFat SD. I also removed the #include <SD.h>.

41186: <p>I have been searching everywhere now and nothing seems to work out for me. When I try to input a new word, it overlaps the previously entered words.<br>
Here is my struct definition: </p>

<pre><code>struct LogEvent{
  char fullname[30];  
} logEvent;
</code></pre>

<p>Here is how I assign a value to fullname:  </p>

<pre><code>strcpy(logEvent.fullname, testName);  
</code></pre>

<p>Here is how I print the output:</p>

<pre><code>for(int i = 0; i &lt;= db.count(); i++)
{
  EDB_Status result = db.readRec(i, EDB_REC logEvent);
  if(result == EDB_OK)
  {
     Serial.print(logEvent.fullname);
     Serial.print(" ");
  }
} 
</code></pre>

<p>Here is the sample output:  </p>

<pre><code>Input 1 - Lebron James  
Output 1- Lebron James

Input 2 - Kobe Bryant
Output 2 - Kobe Bryant Kobe Bryant  (The output should be - Lebron James Kobe Bryant)

Input 3 - LeGoat 
Output 3 - LeGoat LeGoat LeGoat (The output should be - Lebron James Kobe Bryant LeGoat)  
</code></pre>

<p><strong>How to fix this?</strong>  </p>

<p>EDIT. Here is my code:  </p>

<pre><code>#include "Arduino.h"
#include &lt;EDB.h&gt;

// Use the external SPI SD card as storage
#include &lt;SPI.h&gt;  
#include &lt;SD.h&gt;

int recnumber = 1;  
//Arbitrary definition
struct LogEvent {
    int id;
    int temperature;
    char fullname[30];
}
logEvent;  


inline void writer (unsigned long address, const byte* data, unsigned int  recsize) {
    digitalWrite(13, HIGH);
    dbFile.seek(address);
    dbFile.write(data,recsize);
    dbFile.flush();
    digitalWrite(13, LOW);
}

inline void reader (unsigned long address, byte* data, unsigned int recsize) {
   digitalWrite(13, HIGH);
   dbFile.seek(address);
   dbFile.read(data,recsize);
   digitalWrite(13, LOW);
}  
  EDB db(&amp;writer, &amp;reader);

// Run the demo
void setup()
{
    pinMode(13, OUTPUT);
    digitalWrite(13, LOW);

    Serial.begin(9600);
    Serial.println(" Extended Database Library + External SD CARD storage demo");
    Serial.println();

    randomSeed(analogRead(0));

    if (!SD.begin(SD_PIN)) {
        Serial.println("No SD-card.");
        return;
    }

    // Check dir for db files
    if (!SD.exists("/db")) {
        Serial.println("Dir for Db files does not exist, creating...");
        SD.mkdir("/db");
    }

    if (SD.exists(db_name)) {

        dbFile = SD.open(db_name, FILE_WRITE);

      // Sometimes it wont open at first attempt, espessialy after cold start
      // Let's try one more time
        if (!dbFile) {
            dbFile = SD.open(db_name, FILE_WRITE);
        }

        if (dbFile) {
            Serial.print("Openning current table... ");
            EDB_Status result = db.open(0);
            if (result == EDB_OK) {
                Serial.println("DONE");
            } else {
                Serial.println("ERROR");
                Serial.println("Did not find database in the file " + String(db_name));
                Serial.print("Creating new table... ");
                db.create(0, TABLE_SIZE, (unsigned int)sizeof(logEvent));
                Serial.println("DONE");
                return;
            }
        } else {
            Serial.println("Could not open file " + String(db_name));
            return;
        }
    } else {
        Serial.print("Creating table... ");
        // create table at with starting address 0
        dbFile = SD.open(db_name, FILE_WRITE);
        db.create(0, TABLE_SIZE, (unsigned int)sizeof(logEvent));
        Serial.println("DONE");
    }
    deleteAll();
    recordLimit();
    countRecords();  
}
char testName[30];   

void loop()
{
  if(Serial.available())
  {
    Serial.println("Waiting for name...");
    index = 0;
    for(int i = 0; i &lt; sizeof(testName); ++i)
    {
      testName[i] = (char)0;
    }
    while(Serial.available())
    {
      char character = Serial.read();
      testName[index] = character;
      index++;
    }
    createRecords(testName);
    selectAll();
    delay(1000);
  } 
  delay(1000);
 }  

void createRecords(char *testName)
{
  Serial.print("Creating Record... ");
  logEvent.id = recnumber;
  logEvent.temperature = random(1, 125);
  strcpy(logEvent.fullname, testName);
  recnumber++;
  EDB_Status result = db.appendRec(EDB_REC logEvent);
}

void selectAll()
{
   for (int recno = 1; recno &lt;= db.count(); recno++)
   {
      EDB_Status result = db.readRec(recno, EDB_REC logEvent);
      if (result == EDB_OK)
      {
        Serial.print("Recno: ");
        Serial.print(recno);
        Serial.print(" ID: ");
        Serial.print(logEvent.id);
        Serial.print(" Temp: ");
        Serial.print(logEvent.temperature);
        Serial.print(" Fullname: ");
        Serial.print(logEvent.fullname);
        Serial.print(" Length: ");
        Serial.println(strlen(logEvent.fullname));
      }
    }
 }  
</code></pre>

<p>Here is the output:  </p>

<pre><code>Extended Database Library + External SD CARD storage demo

Openning current table... DONE
Truncating table... DONE
Record Limit: 2045
Record Count: 0
Record Count: 0
Waiting for name...
Name received: Kobe Bryant
LogEvent Fullname: 
The sentence entered is 11 characters long
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Kobe Bryant Length: 11
Waiting for name...
Name received: Lebron James
LogEvent Fullname: Kobe Bryant
The sentence entered is 12 characters long
Recno: 1 ID: 1 Temp: 64 Fullname: Kobe Bryant Length: 11
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Lebron James Length: 12
Recno: 2 ID: 2 Temp: 78 Fullname: Lebron James Length: 12
Waiting for name...
Name received: Michael Jordan
LogEvent Fullname: Lebron James
The sentence entered is 14 characters long
Recno: 1 ID: 1 Temp: 64 Fullname: Lebron James Length: 12
Recno: 2 ID: 2 Temp: 78 Fullname: Lebron James Length: 12
Creating Record... Done Creating Record...
Recno: 1 ID: 1 Temp: 64 Fullname: Michael Jordan Length: 14
Recno: 2 ID: 2 Temp: 78 Fullname: Michael Jordan Length: 14
Recno: 3 ID: 3 Temp: 29 Fullname: Michael Jordan Length: 14  
</code></pre>

<p>Update: I tried to use <code>memset</code> but the result is still the same as above.</p>
 41186: <p>I managed to solve the problem. The problem is with the SD card library of Arduino. I downloaded this library <a href="https://github.com/greiman/SdFat/tree/master/examples" rel="nofollow noreferrer">sdFat library</a>, included it in the sketch <code>#include "SdFat.h"</code>, and defined <code>SdFat SD</code>. I also removed the <code>#include &lt;SD.h&gt;</code>.</p>
