首页 > 解决方案 > 如何检查 C tiny c 编译器中是否存在文件

问题描述

我使用的是微型 c 编译器,当我尝试运行我的程序时遇到问题,我收到消息“未找到包含文件‘unistd.h’”

#include<unistd.h>
#include<stdio.h>

int main()
{
    char openfile[100];
    char entercommand[100];

    scanf("%s",entercommand);
    if(entercommand == "cat.exe")
    {
        printf("please enter the name of the file : \n");
    }

    scanf("%s",openfile);
    if(access(openfile,F_OK) != -1)
    {
        printf("the file exists \n");
    }
    else
    {
        printf("the file does not exist \n");
    }

    return 0;
}

标签: c

解决方案


推荐阅读