How to Read multiple long integers from sd file?

The integers in the sd card is like the form of
1
33
45
128
44
44.
.
.

and i want to check if there is repliccation of numbers like the one above and notice me by lightning red led

i tried the code and Please Help me

const int chipSelect = 4;

void setup()
{
char fileStr[] = "987654"; // example of what is in the file

char result[7]; // value are between 0/999940? so lenght is 6 characters + 1 ('\0')
uint8_t i = 0; // a counter

while (fileStr[i] != '\0' && i < sizeof(result) - 1) // while character isn't the string terminator
{
  result[i] = fileStr[i]; // store character in result
  i++; // increase counter
}
result[i] = '\0';

unsigned long number = atol(result); // convert result string to numeric value
Serial.print(number); // print the number
}

And what happened?

The way you approach this may depend on the Arduino board you use and the maximum size of the file.

For example, if you know that the list of integers in the file would never exceed 100 and each integer is read into an array of long then that would consume 400 bytes of RAM storage. You could read the entire list of numbers and then search the array of long integers for duplicates.

Worst case, if the number of integers in the list is only limited by the SD card size you may have to read the card over and over again to determine if there are duplicate integers. This would be substantially slower than the above method where the card is only read one time.

I agree with @ToddL1962; you need to be careful of how large the file is.
Saying that, if you don't have too many numbers, you could try this:

//returns the duplicate value if a duplicate is found, otherwise, -1 is returned
int returnDuplicateNumber(const unsigned int *arr, const size_t sz){
    
    int val = 0, matchCount = 0;
    
    //Returns val if a val is found twice in arr
    for(int i = 0; i < sz; i++){
        
        val = arr[i];
        
        for(int j = 0; j < sz; j++)
            if(arr[j] == val)
                matchCount++;
                
        if(matchCount == 2)
            return val;
            
        matchCount = 0;

    }
    
    return -1; 
}

so then, you can drive your LED if this function returns any value other than -1.
If you want to be able to do negative numbers, then I'd change the function to

//returns true if a duplicate is found and false if no duplicates are found
bool isDuplicateInArray(const int *arr, const size_t sz){
    
    int val = 0, matchCount = 0;
    
    //Returns true if a val is found twice in arr
    for(int i = 0; i < sz; i++){
        
        val = arr[i];
        
        for(int j = 0; j < sz; j++)
            if(arr[j] == val)
                matchCount++;
                
        if(matchCount == 2)
            return true;
            
        matchCount = 0;

    }
    
    return false; 
}

which means you will be able to look for duplicates in arrays with negative numbers, although you wouldn't be able to know what that repeated value is.

@bradley2020 those functions are a good start. Only issue I see is that the comments in the OP code says the integer could be up to 999940 in value so you would need a long type instead of an int.

I want to read about 250 number arrey and the integers are on the form of
1
2
.
.
250

How to make it read without consuming much of arduino RAM and just read it very quickly. And i would like to say tnx guys for the privious answers and send me tge code if you can please