Alls it does is accept an NT or Nix command as input and output the results. Pretty simple but ya
Code: Select all
#include <iostream>
#include <stdlib.h>
#include <cstring>
using std::cout;
using std::cin;
int run_sys_call(char *command);
int main()
{
char *input = new char[1024];
char buffer[50] = {0};
int input_length = 0;
cout << "Enter a unix or dos command: ";
while(cin.get(buffer, 50))
{
if(input_length + strlen(buffer) > 1024)
break;
if(strlen(buffer) == 0)
break;
memcpy(input+input_length, buffer, strlen(buffer));
input_length += strlen(buffer);
}
run_sys_call(input);
delete[] input;
return 0;
}
int run_sys_call(char *command)
{
system(command);
}