Created
March 29, 2013 16:24
-
-
Save opamp/5271902 to your computer and use it in GitHub Desktop.
windowsで空ファイルの作り方がわからなかったので
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
int mk_file(char*); | |
int main(int argc,char* argv[]){ | |
int n; | |
if(argc <= 1){ | |
printf("%s filename1 filename2 ....¥n",argv[0]); | |
return 0; | |
} | |
for(n = 0;n < argc;n++){ | |
if(mk_file(argv[n]) == -1){ | |
printf("ERROR::Fail to make %s¥n",argv[n]); | |
} | |
} | |
return 0; | |
} | |
int mk_file(char* name){ | |
FILE* f; | |
if((f = fopen(name,"w")) == NULL){ | |
return -1; | |
} | |
fclose(f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment