#include <iostream> int main(int arc, const char *argv[]) { while (true) { char buf[1024]; char command[100]; char path[100]; std::cout << "Enter command and path: "; std::cin.getline(buf, 100); int i, j; for (i = 0; (buf[i] != ' ') && (buf[i] != '\n'); command[i] = buf[i], i++); if ((buf[i] == ' ') && (buf[i + 1] != '\n')) { i += 1; for (j = 0; (buf[i] != ' ') && (buf[i] != '\n'); path[j] = buf[i], j++, i++); } std::cout << "command = " << command << " path = " << path << std::endl; } return 0; } fix the code ... it does not work correctly I need each time I type the command and the path and the program separates the command from the path into different arrays But here if the command is shorter than the previous command, then it is not pre-written in the array ...
\0do not write. - Qwertiy ♦