Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* command = "";
- char** arguments[10][100];
- int* argumentLen[10];
- int argumentsLen = 0;
- int commandLen = 0;
- int inputIndex = 0;
- for(int i = 0;i < 100;i++){
- if(input[inputIndex] == ' '){
- commandLen = inputIndex+1;
- break;
- }
- command[i] = input[inputIndex];
- inputIndex++;
- }
- command[commandLen] = '\0';
- for(int j = 0;j < 10;j++){
- for(int i = 0;i < 100;i++){
- if(input[inputIndex] == ' ' || input[inputIndex] == '\0'){
- argumentLen[j] = inputIndex+1;
- inputIndex++;
- break;
- }
- arguments[j][i] = input[inputIndex];
- inputIndex++;
- }
- arguments[j][*argumentLen[j]] = '\0';
- if(input[inputIndex] == '\0'){
- argumentsLen = j;
- break;
- }
- inputIndex++;
- }
- if(strcmp(command, "vypis")){
- printf("%s", arguments[0][0][0]);
- } else {
- printf("tento prikaz nepoznam )-:");
- }
Add Comment
Please, Sign In to add comment