What happens if there isn't a \n in the file?
My file is written in that way. There are 12 lines for 12 products.
Each line is composed of the name of the product and its quantity.
What happens if the record is more than 23 characters long?
What happens if there are more than 24 records in the file?
Can't happen. There are less than 23 characters, every line has the same number of characters. I wrote the sorting programme apart and tested it without any problem.
I use an Ethernet shield for the SD card and I picked up the code on the arduino website.