A function to handle multiple datatypes

EEPROMWriteAnything uses templates. Here:

#include <Arduino.h>  // for type definitions
#include <EEPROM.h>

template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
    const byte* p = (const byte*)(const void*)&value;
    unsigned int i;
    for (i = 0; i < sizeof(value); i++)
	    EEPROM.write(ee++, *p++);
    return i;
}

The templated type T is used to write to EEPROM.