Create a C program that functions as a DOS command interpret

Create a C program that functions as a DOS command interpreter. DOS uses commands cd, dir, type, del, ren, copy. The script loops continuously allowing user to type DOS commands stored in variables: command, arg1, & arg 2. Commands should be considered by a case statement which executes an appropriate UNIX command depending on which DOS command given. Program should echo instruction \"Type Ctrl-C to exit\".

Solution

#include <stdio.h>
#include <string.h>

void copy_string(char [], char []);

int main() {
char s[1000], d[1000];

printf(\"Input a string\ \");
gets(s);

copy_string(d, s);

printf(\"Source string: \\\"%s\\\"\ \", s);
printf(\"Destination string: \\\"%s\\\"\ \", d);

return 0;
}

void copy_string(char d[], char s[]) {
int c = 0;

while (s[c] != \'\\0\') {
d[c] = s[c];
c++;
}
d[c] = \'\\0\';
}

Create a C program that functions as a DOS command interpreter. DOS uses commands cd, dir, type, del, ren, copy. The script loops continuously allowing user to

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site