Update filename-test

This commit is contained in:
daleclack 2021-01-02 22:39:59 +08:00
parent b73e6fbf49
commit 0b77efbf7f
3 changed files with 1559 additions and 4 deletions

1546
codeblocks/default.conf Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="56" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -18,14 +18,13 @@ void write1(){
} }
void test(){ void test(){
char filename[57]; char filename[57],str[57];
FILE *fp; FILE *fp;
fp=fopen("test","r"); fp=fopen("test","r");
if(fp==NULL){printf("File not exist!");return ;} if(fp==NULL){printf("File not exist!");return ;}
fgets(filename,57,fp); fgets(str,57,fp);
fclose(fp); fclose(fp);
int length=strlen(filename); sprintf(filename,"xe-%c.x",str[0]);
filename[length-1]='\0';
fp=fopen(filename,"w"); fp=fopen(filename,"w");
fclose(fp); fclose(fp);
} }