Create a queue/list on a SD card

Hi

I have to save a lot of strings in a fifo queue. The strings contains sms texts.

On my shield i have a sd card slot so i was thinking that i might be able to save the texts on the sd card easy?

Can i make a list on the sd card if yes how if not have you all got any other ideas?

i was thinking that i might be able to save the texts on the sd card easy?

Yes, you can, and yes, it is.

Can i make a list on the sd card

No. You can make a file on the SD card. What you put in that file is a different story.

I'd use one file per SMS. I understand the SD library will timestamp your files if you configure it with a suitable time source. An RTC module would be a suitable time source. With timestamped files, it would be easy to implement a FIFO structure on the SD.

If you don't timestamp the files you will need some other scheme to order them, such as including a sequence number in the file name.

A circular queue would be one way to do this. Allocate a file large enough to accommodate the maximum queue size. Store the current insertion point at the beginning of the file, followed by a sequence of SMS records. Each record contains a sequence number, size and string. You could store the next sequence number (used for the next record to be inserted) in the file, or scan the file at startup to determine. Initialize the file to all zeros, when you scan the file forward from the insertion point you can detect the end of the queue when you read a sequence number less than the last one read.

I do have a queue already

Ill look at making a file pr text