我的C程序由于未知原因而崩溃

时间:2019-04-10 22:27:06

标签: c

所以我的程序原本是个小命令行,但它一直崩溃:

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>    

void main()
{    
    char cmd;
    for(;;)
    {
        fgets(cmd,255,stdin);
        if (strstr(cmd,"CD")!=NULL )
        {
            cmd +=2;
            SetCurrentDirectory(cmd);
        }
        else
        {
            system(cmd);
        }
    }
}

编译器的输出是左值。

1 个答案:

答案 0 :(得分:1)

也许您正在寻找做这样的事情:

=
相关问题