Hi everyone.
I'm working on a personal project that controls users access trought a Keypad, each user have a code and I declared it like this:
char user1[]="67202";
char user2[]="62601";
char user3[]="60920";
Then if my arduino received an external order to delete any user or create a new one it works, no problem on that. So if i delete the 67202 (user1) and i try to introduce this code trough the keypad my program return "Incorrect code".
if(strcmp(baja, user1) == 0){user1[0]='b';} //baja is a string with the user code i want to delete
else if(strcmp(baja, user2) == 0){user2[0]='b';}
else if(strcmp(baja, user3) == 0){user3[0]='b';}
// alta is the code of the new user, so i check my list and when i find a deleted user, overwrites it with the new code.
if(user1[0]=='b'){user1[0]=alta[0],user1[1]=alta[1],user1[2]=alta[2],user1[3]=alta[3],user1[4]=alta[4];}
else if(user2[0]=='b'){user2[0]=alta[0],user2[1]=alta[1],user2[2]=alta[2],user2[3]=alta[3],user2[4]=alta[4];}
else if(user3[0]=='b'){user3[0]=alta[0],user3[1]=alta[1],user3[2]=alta[2],user3[3]=alta[3],user3[4]=alta[4];}
Where I have the problem is when I turn off the arduino power cause I have to store changes into a non-volatil memory. I've been reading this past days about SD card options. Actually I bought an SD shield and i try some library SD.h example that works perfectly.
I want to save my users list in to the SD, so I can read it when my program starts and if there is any change (some user is deleted or just i add a new one) save it before the arduino turn off.But if i have my users list save in to a txt file, how can i use it as arrays like i'm doing right now that i have it write in the flash memory??
I hope i explain my problem well cause my english could be not good enough.
Thanks so much for you time!