C语言怎样在一个循环里创建不同的文件?
C语言怎样在一个循环里创建不同的文件名
sprintf
希望我的回答对你有用。
#include "stdio。h"#include "stdlib。h"#include "string。h"fun( int a,int b ){ char str[100]="c:\\",temp[32],temp1[100]; FILE *fp; itoa(a,temp,10); strcat( str,temp ); strcpy( temp1,"cmd /c md "); strcat( temp1,str ); system(temp1); itoa(b,temp,10); strcat( str,"\\" ); strcat( str,temp ); strcat( str,"。
txt" ); fp=fopen(str,"w"); fprintf(fp,"%d%d",a,b); fclose(fp);}main(){ fun( 1,23 );}。
答:#include #include #include #include using namespace std; viod main() { strin...详情>>
问:挺简单的一C函数,不过我是初学者,暂时还不会写,请好心人多多帮忙!
答:int mystrlen(char *str) { int n = 0; while (*str) { n++; str++;} return n; } voi...详情>>