第18课只能做到cls命令了,dir就算了,哈哈,我们真的没有读入磁盘哟!

因为包含<stdio.h>不能成功编译,所以自己写了个比较字符串相等的函数(也算这些日子以来自己唯一写的C函数吧)

int strcmp(char * str1, char * str2) {
    int len1 = 0, len2 = 0;
    char *a, *b;
    a = str1;
    b = str2;
    while (*a++)
        len1++;
    while (*b++)
        len2++;
    if (len1 != len2)
        return -1;
    while (*str1++ != 0 && *str2++ != 0) {
        if (*str1 != *str2) {
            return -1;
        }
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_39410618/article/details/82291460