PDA

View Full Version : No command prompt avaliable



bljonk
01-18-2002, 11:19 AM
we've this new computer at school( 'Dell' running Win2k Pro), but they don't happen to have the Ms-DOs command prompt avaliable in the student account, so ( i thought it would be fun to hack a simple program called 'console' to sub. it), have this source code:

#include <stdio.h>
#include <stdlib.h>
#define console\ ___________________Console_____________________

int main(int argc, char *argv[]){
char *command[];
int count = 1;
printf("Console\n")
while((count) || (strcmp(command,"exit"))!= 0){
count--;
printf("?> ");
scanf("%s", command);
system(command);
}
system("cls");
return 0;
}

only the network commands happen to work, none does 'dir' or 'cd' . what in the hell is wrong with the program.

thx in advance!

Salem
01-18-2002, 11:40 AM
> char *command[];
This is a meaningless declaration
char command[80];

> scanf("%s", command);
This only reads the first word

In the spirit of the program, try
gets( command );