Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
802 B
1
Indexable
char buffer[256];
    int startidx, endidx, j;
    

    while(fgets(buffer, 256, database_file)){
        
        char tempstr1[20];
        char tempstr2[20];
        char gender[1];
        char firstname[20];
        char lastname[20];

        gender = buffer[0];
        startidx = 2;
        endidx = 2;
        while(buffer[endidx] != " "){
            endidx++;
        }

        j = 0;
        for (int i = startidx; i < endidx; i++)
        {
            tempstr1[j] = buffer[i];
            j++;
        }
        
        firstname = tempstr1;

        j = 0;
        for (i = endidx + 1; i < strlen(buffer); i++){
            tempstr2[j] = buffer[i];
            j++;
        }

        lastname = tempstr2;
        
    }
    

    fclose(database_file);

    traverseDirectories(".");