I got to this point:
Code:
char input[82];
char col [6];
char name [MAXCARAC];
unsigned int a, b;
double c;
if(fgets(input, sizeof(input), stdin)){
if(input[0] == 'q' && input[1] == '\n' && input[2] == '\0'){
return -1;
}
if(input[0] == 'p' && input[1] == '\n' && input[2] == '\0'){
list(matrix);
}
else if(input[0] == 'i' && input[1] == '\n' && input[2] == '\0'){
carac(matrix);
}
else if((sscanf(input, "%c %u %u %lf\n", &input[0], &a, &b ,&c) == 4)){
adds(a, b, c, matrix);
}
else if(input[0] == 'l' && (sscanf(input, "%u\n", &a) == 1)){
printLine(a , matrix);
}
else if(input[0] == 'c' && (sscanf(input, "%u\n", &a) == 1)){
printColumn(a , matrix);
}
else if(input[0] == 'z' && (sscanf(input, "%u\n", &a) == 1)){
zero(a , matrix);
}
else if(input[0] == 'o' && input[1] == '\n' && input[2] == '\0'){
sortLine(matrix);
}
if(input[0] == 'o' && (sscanf(input, "%s\n", col) == 1) ){
sortColumn(matrix);
}
else if(input[0] == 'w' && input[1] == '\n' && input[2] == '\0'){
file(matrix);
}
if(input[0] == 'w' && (sscanf(input, "%s\n", name) == 1) ){
newFile(name, matrix);
}
}
But im struggling with the "q" command that is supposed to exit the program... any advice on how i should do it?