eeprom anything

ran into the eeprom anything code,
once I realised that, as its name implies, you can read / write anything,
was a doddle.
this should be in the main code me thinks,

An example on the text page, of not using a record , like using a word would be a great clarifier.

And the question....

How to write a constant to EEPROM,

something like

EEPROM_writeAnything( MyAddress, 0x3A );

how to tell writeAnything what size the 3A is,

specificaly, I was trying to write decimal numbers, how do I tell anything to write a byte/ word / long / etc,

TA

drjiohnsmith:
How to write a constant to EEPROM, something like

EEPROM_writeAnything( MyAddress, 0x3A );

how to tell writeAnything what size the 3A is,

You can cast the type:

EEPROM_writeAnything( MyAddress, (unsigned char) 0x3A );
EEPROM_writeAnything( MyAddress, (unsigned int) 0x3A );
EEPROM_writeAnything( MyAddress, (long) 0x3A );

thank you ..

a Dahh moment here.

I'm certain I tried a cast like that , but it generated a compile error.
just done it again, and YES, it works.

thanks ,