- 论坛徽章:
- 0
|
- #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,0755)<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[]){
- int i;
- if(argc<2){
- perror("you haven't input the filename,please try again!\n");
- exit(EXIT_FAILURE);
- }
- for(i=1;i<argc;i++){
- create_file(argv[i]);
- }
- exit(EXIT_SUCCESS);
- }
复制代码 确实对perror的用法不太熟悉
可是在这个里面 perror的出错信息为什么后面就没有跟一个:Success 呢? |
|