updated:SD/eeprom read and write,

hi all,
thanks for looking, i have been trying to find a nice way to open a txt file on an sd card, read the hour and compare it to the current time from a ds1307,

i have moderate experience with arduino and my current code is massive and i need this for a recall,

basically the sketch writes the hour to an hour.txt file every 30 minutes the device is on, when its reset it will check the sd card, compare it to the current hour, and if less than 2 hours, display a recall screen offering an option to return to previous state or begin a new state

i kow this involves reading bytes and the such but i am lost with these. if anyone can shed light on a way to read a 2 digit number from sd, save it as an int, compare to hour from ds1307 and then make a choice.
all my code works and id rather not share it as im just adding functions. im using the standard sd library and no folders on the sd, on mega 2560 with touchscreen tft,wav playback,rtc,.

thanks for your help,

Given that you're talking about a tiny amount of data and only changing once per hour, wouldn't it be simpler to store it in EEPROM? No reason not to store it on an SD card if you prefer, just seems like more work formatting and parsing the file content for no particular benefit.

hi, yeah funny you mention that, as soon as i posted that i did think, its a lot to read a 2 digit number, i have looked into eeprom write anything library and this looks like the one m going to go with just the example is confusing,

#include <EEPROM.h>
#include "EEPROMAnything.h"

struct config_t
{
long alarm;
int mode;
} configuration;

void setup()
{
EEPROM_readAnything(0, configuration);
// ...
}
void loop()
{
// let the user adjust their alarm settings
// let the user adjust their mode settings
// ...

// if they push the "Save" button, save their configuration
if (digitalRead(13) == HIGH)
EEPROM_writeAnything(0, configuration);
}

this is what im lookng at,but not sure how its doing it?

from what i cant see, the struct_configt is a function which holds the alarm time and mode, in my case this would be old hour, current hour,

the ' 0 ' in the last line is the start address of the eeprom, i need to get it to a nice simple eepromwrite(0,oldhour = x)
and then then compare it to the current hour with an if,

if (oldhour < newhour) {do this}else{do that};

im not entirely sure how to compare it and test if its less than 2 hours or more than 2 hours ago.

i still want the data written to sd card for a log but thats fine, im ok writing to it, just reading it back seems like more work than it should be?

have you anythoughts on sdfat library?