C programming usin cmd prompt on windows

Viewed 91
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
    char command[20];

    system("dir");

    while(1){
    printf("\n\n");
    scanf("%s", &command);
    system(command);
    }

    return 0;
}

this is my code, it's a console app written in C and I wanna be able to control the cmd prompt of my computer, whenever I run new command like cd.. the path always goes back to where it was before, how do i make it like a process? sorry I'm new to it.

3 Answers
Related