我试图用 C 语言制作一个类似于 DOS 的 shell 解释器(显然是为了好玩)
当我键入 clear 时,如下面的代码所示,它应该可以清除屏幕。但事实并非如此。
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
char command[128];
int loop = 0;
void main(){
clrscr();
printf("Starting shell\n");
clrscr();
while ( loop == 0){
printf("command:");
scanf("%s", &command);
if(command=='clear'){
printf("Clearing screen");
clrscr();
}
/** Other Code **/