Hello! I'm doing a project in C for college, where I have to use .csv files. It's almost finished, but I need some help. I created a account on Stack Overflow, but some of the other users treated me in a bad way, maybe because I'm somewhat a newbie at programming. So, I decided to join this forum, for me to get some help. Sorry if you don't understand something, because english isn't my first language.

One of the things I have to do is search for meteorological information from a .csv file, named "meteo.csv". In the function
Code:
search_date_by_city
, which code is down below, I ask the user to search for a city, then I confirm if that city exists in other file ("cities.csv"), and then I ask for a date, in the format YYYY-MM-DD. That function calls another one,
Code:
search_meteo_by_city_by_date
, that confirms if the date really exists on the file "meteo.csv", as well if the city's id exists in that file. (Every city has an specific id). However, the 'if' inside the cycle 'for' has an error. I know I can't compare a string with an integer, I know that is possible to convert in one another,but I don't know if I can use that in this case. 'id' is an integer, and 'meteo_city_id' is a string. Sincerely, I don't know what to do.
At the same time, in that same 'for', there is 'i < 152', that is the number of rows each file has. However, it's possible for the user to add rows in the file. If it adds some rows, that code doesn't work anymore. How can I replace this number with a variable that defines the end of the file, regardless of the number of lines added later?

Sorry if the task is a bit confuse. All help is welcome. Thanks.

Here is the code:

Code:
typedef struct city_t{    char city_id[TAM_STR];
    char city_name[TAM_STR];
    char county_name[TAM_STR];
    char district_name[TAM_STR];
} city_t;


typedef struct meteo_t{
    char meteo_id[TAM_STR];
    char meteo_city_id[TAM_STR];
    char tempt_max[TAM_STR];
    char tempt_min[TAM_STR];
    char humidity[TAM_STR];
    char preassure[TAM_STR];
    char date[11];
} meteo_t;

void search_meteo_by_city_by_date(meteo_t *meteo, size_t len, const char *city, const int id, const char *date)
{       
    bool find = false;
   
    if(meteo == NULL || city == NULL || id == NULL || date == NULL) {
        printf("ERROR");
    }


    for(size_t i = 0; i < 152; ++i) {
        if (strcasecmp(date, meteo[i].date) == 0 && id == meteo[i].meteo_city_id) {
            find = true;
            printf("Informations for: %s in %s \nMaximum temperature: %s ºC\nMinimum temperature: %s ºC\nHumidity: %s \nPressure: %s hPa\n\n\n", city, date, meteo[i].tempt_max, meteo[i].tempt_min, meteo[i].humidity, meteo[i].preassure);
        }
    }
    if(find == false) {
        printf("No data for: %s\n", city);
    }
}

void search_date_by_city() {


    size_t cities_len;
    city_t *cities = read_cities("cidades.csv", &cities_len);
    char local[100];
    char date[100];
    
    // error
    if(cities == NULL) {
        printf("ERROR");
    }
    
    printf("City: ");    
    scanf("%[^\n]%*c", local);  
    
    int id = search_for_city_by_name(cities, &cities_len, cidade);


    if(id == -1) {
        printf("That city doesn't exist\n");    
        return;
    }


    printf("Date: ");    
    scanf("%[^\n]%*c", date);  


    size_t meteo_len;
    meteo_t *meteo = read_meteo("meteo.csv", &meteo_len);
    
    if(meteo == NULL) {
        printf("ERROR");
    }


    search_meteo_by_city_by_date(meteo, &meteo_len, cidade, id, date);
}