Thread: No command prompt avaliable

  1. #1
    Registered User bljonk's Avatar
    Join Date
    Oct 2001
    Posts
    70

    No command prompt avaliable

    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!
    Ünicode¬>world = 10.0£

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > 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 );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL_FillRect problem
    By Frost Drake in forum Game Programming
    Replies: 4
    Last Post: 09-16-2006, 09:32 PM
  2. what functions are avaliable in kernel32.dll?
    By Fishskin in forum Windows Programming
    Replies: 3
    Last Post: 09-17-2005, 01:30 PM
  3. anyone avaliable
    By xlord in forum C Programming
    Replies: 2
    Last Post: 10-20-2002, 03:03 PM