I would compare each character as it is read from the file and stop as soon as there was a mismatch.
#include "SD.h"
void setup() {}
void loop() {}
char readCard[5];
boolean rfidMatchDisp(unsigned long recIndex) {
int result = true; // assume success
long rfidPosition = 0;
File dataFile = SD.open("TAGREF.CSV", FILE_READ); // Open the file
dataFile.seek(recIndex + 1); // recIndex is from another function...
rfidPosition = dataFile.position() + 1; // Index the RFID position for reading
dataFile.seek(rfidPosition);
// look at each character
for (int i = 0; i < 4; i++ ) {
// if not a match, set return value and stop looking
if ( dataFile.read() != readCard[i])
{
result = false;
break;
}
}
dataFile.close();
return (result);
}