I have a commands.txt file that read like this:

```
LIST1
LIST2
LIST3
ASSIGN C6650 SENG101
ADD 1 SENG101
LIST4 1
LIST5 C6650
LIST6 SENG101
LIST7 15
DROP 1 SENG101
LIST4 1
LIST6 SENG101
LIST7 15

```

I sent this file as an argument to my program. The objective is: Read the commands.txt file and execute commands inside of it. (Each line is command)

Where `LIST1,LIST2,LIST3,ASSIGN,ADD,LIST4,LIST5,LIST6,LIST7,DROP` are functions that I'll write. But I'm reading these from a text file.

So, how would I be able to use these as commands for my program?

I used strcmp. So I'm able to compare the string I read with what I know as possible commands. Then, if they match, I want to call the requested function.

I could do all the comparisons if they were all one word, but how do I do the `ASSIGN C6650 SENG101` command for example? `C6650` and `SENG101` may change even if ASSIGN remains constant. In this code, `C6650` is the teacher's code and `SENG101` is the code of the course.

I would really like to see some example code to help understanding.
The code I've written so far:

```
#include <stdio.h>
#include <string.h>

#pragma warning (disable:4996)
#define MAXCHAR 100

struct students {
    int studentNumber;
    char studentSurname[50];
    char studentName[50];

};
struct courses {
    char courseCode[7];
    char courseName[50];
    int courseCredit;

};
struct lecturers {
    char regNumber[5];
    char regSurname[50];
    char regName[50];

};

/*
        PLEASE SEND ARGUMENTS IN THE FOLLOWING ORDER TO THE PROGRAM
        Ex: C:>DBMS students.txt lecturers.txt courses.txt commands.txt output.txt
*/

int main(int argc, char* argv[])
{
    char com1[] = "LIST1";
    char com2[] = "LIST2";
    char com3[] = "LIST3";
    char com4[] = "LIST4";
    char com5[] = "LIST5";
    char com6[] = "LIST6";
    char com7[] = "LIST7";
    char com8[] = "ASSIGN";
    char com9[] = "ADD";
    char com0[] = "DROP";

    char readed[MAXCHAR];

    FILE* fstudent = fopen(argv[1], "r"); // "r" for read
    FILE* flecturers = fopen(argv[2], "r"); // "r" for read
    FILE* fcourses= fopen(argv[3], "r"); // "r" for read
    FILE* fcommands = fopen(argv[4], "r"); // "r" for read
    FILE* foutput = fopen(argv[5], "a+"); // "a+" for append

    while (fgets(readed, MAXCHAR, fcommands) != NULL) {
        printf("%s", readed);                               //I DONT KNOW SHOULD WE TAKE THEM LINE BY
        readed[strcspn(readed, "\n")] = 0;                  //LINE OR WORD BY WORD? THIS IS THE LINE
                                                            //BY LINE VERSION.
        if (0 == strcmp(com1, readed)) {
            //LIST1
            printf("----------------LIST1------------\n");
        }
        if (0 == strcmp(com2, readed)) {
            //LIST2
            printf("----------------LIST2------------\n");
        }
        if (0 == strcmp(com3, readed)) {
            //LIST3
            printf("----------------LIST3------------\n");
        }
        if (0 == strcmp(com4, readed)) {
            //LIST4
            printf("----------------LIST4------------\n");      //The required function will be called 
                                                                //here. I used printf to just try it out.
        }
        if (0 == strcmp(com5, readed)) {
            //LIST5
            printf("----------------LIST5------------\n");
        }
        if (0 == strcmp(com6, readed)) {
            //LIST6
            printf("----------------LIST6------------\n");
        }
        if (0 == strcmp(com7, readed)) {
            //LIST7
            printf("----------------LIST7------------\n");
        }
        if (0 == strcmp(com8, readed)) {
            //ASSIGN
            printf("----------------LIST8------------\n");
        }
        if (0 == strcmp(com9, readed)) {
            //ADD
            printf("----------------LIST9------------\n");
        }
        if (0 == strcmp(com0, readed)) {
            //DROP
            printf("----------------LIST0------------\n");
        }       
    }

    /*
     while (fscanf(fcommands, "%s", readed) != EOF)
     {                                                        //I DONT KNOW SHOULD WE TAKE THEM LINE BY 
         printf("%s\n", &readed);                             //LINE OR WORD BY WORD? THIS IS THE WORD 
                                                              //BY WORD VERSION.
     }
    */   

    return 0;
} 

```

When I run this program with sending arguments, as you can see in the picture, `if` lines do not work after `LIST3` because `readed` variable holds more than one word.

[Picture:](https://i.stack.imgur.com/Iaww1.png)

So how can I solve these problems? I will be grateful if you could help me.