mmm1245

Untitled

Sep 2nd, 2019
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. char* command = "";
  2. char** arguments[10][100];
  3. int* argumentLen[10];
  4. int argumentsLen = 0;
  5. int commandLen = 0;
  6.  
  7.  
  8. int inputIndex = 0;
  9. for(int i = 0;i < 100;i++){
  10. if(input[inputIndex] == ' '){
  11. commandLen = inputIndex+1;
  12. break;
  13. }
  14. command[i] = input[inputIndex];
  15. inputIndex++;
  16. }
  17. command[commandLen] = '\0';
  18.  
  19. for(int j = 0;j < 10;j++){
  20. for(int i = 0;i < 100;i++){
  21. if(input[inputIndex] == ' ' || input[inputIndex] == '\0'){
  22. argumentLen[j] = inputIndex+1;
  23. inputIndex++;
  24. break;
  25. }
  26. arguments[j][i] = input[inputIndex];
  27. inputIndex++;
  28. }
  29. arguments[j][*argumentLen[j]] = '\0';
  30. if(input[inputIndex] == '\0'){
  31. argumentsLen = j;
  32. break;
  33. }
  34. inputIndex++;
  35. }
  36.  
  37. if(strcmp(command, "vypis")){
  38. printf("%s", arguments[0][0][0]);
  39. } else {
  40. printf("tento prikaz nepoznam )-:");
  41. }
Add Comment
Please, Sign In to add comment