Cannot read from sd card.

Hi, I have this code i am working on for a clock. The problem I am have is reading two files. hours.txt and minutes.txt I need to get these integers to set the alarm time. When I read these files I just get 49-1. What does this mean? Also how can I fix this code? Any help would be great.

#include <Wire.h>
#include <RTClib.h>
#include <SD.h>
#include <TMRpcm.h>
#include <SPI.h>

RTC_DS1307 rtc;
TMRpcm tmrpcm;
#define SD_ChipSelectPin 4

String inputString = "";
boolean stringComplete = false;
int t = 0;
int h = 0;
int m = 0;
int s = 0;
String data = "";
int alarmhours = 0;
int alarmminutes = 0;
File myfile;

void setup () {
  inputString.reserve(200);

  tmrpcm.speakerPin = 9;
  if (!SD.begin(SD_ChipSelectPin))
  {
    Serial.println("SD fail");
    return;
  }
  tmrpcm.setVolume(5);


  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  //Get Alarm Time
  myfile = SD.open("hour.txt");
  data = myfile.read();
  alarmhours = data.toInt();
  myfile.close();
  myfile = SD.open("minutes.txt");
  data = myfile.read();
  alarmminutes = data.toInt();
  myfile.close();
}

void loop () {
  //Set time from Serial Monitor. Enter each number hours,minutes,second press enter in between
  serialEvent();

  if (stringComplete) {
    Serial.println(h);
    t = inputString.toInt();
    if (h != 0 && m != 0 && s == 0) {
      s = t;
    }
    if (h != 0 && m == 0) {
      m = t;
    }
    if (h == 0) {
      h = t;
    }
    if (h != 0 && m != 0 && s != 0) {
      rtc.adjust(DateTime(2000, 0, 0, h, m, s));
      h = 0;
      m = 0;
      s = 0;
    }
    inputString = "";
    stringComplete = false;
  }
  //Get Time
  DateTime now = rtc.now();
  //Spit time into Serial Monitor
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
  Serial.print(alarmhours, DEC);
  Serial.print(alarmminutes, DEC);
  Serial.println();


  //Clock Display Code
  if (alarmhours == now.hour() && alarmminutes == now.minute()) {
    tmrpcm.play("test.wav");
    delay(100000);
  }
  delay(1000);
}



void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

Read only gets you a single character from the file.

Serial print your data String to see what you actually got.

That makes since, but if the files had numbers in then such as 14 and 30 how would I get 49-1 as an output. Also If I use the iscp pins for this on an arduino mega, can I drive leds on pin 51, 52, 50?

49 is the ascii code for character '1'. -1 is what read returns if there is nothing to get.

Ah that makes sense. Thanks wildbill.