⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file_creat.c

📁 国嵌所有的实验代码
💻 C
字号:
#include <stdio.h> 
#include <stdlib.h> 
#include <sys/types.h> 
#include <sys/stat.h> 
#include <fcntl.h> 

void  create_file(char *filename)
{ 
    /*创建的文件具有可读可写的属性*/	
    if(creat(filename,0666)<0)
	{ 
        printf("create file %s failure!\n",filename); 
        exit(EXIT_FAILURE); 
    }
	else
	{ 
        printf("create file %s success!\n",filename); 
    } 
} 

int main(int argc,char *argv[])
{ 
    /*判断入参有没有传入文件名 */
   	if(argc<2)
	{ 
        printf("you haven't input the filename,please try again!\n"); 
        exit(EXIT_FAILURE); 
    } 
	create_file(argv[1]);    
	exit(EXIT_SUCCESS); 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -