0
我有一大堆的文件系统编号喜欢Mesh0Coord.dat
,Mesh0Elem.dat
,Mesh1Coord.dat
,Mesh1Elem.dat
等,这就是我想做的事:的fopen整数文件名
int ID;
FILE *fp;
ID = 0; /* could be 0, 1, 2, etc. and so on for the names of the files */
fp = fopen(“Mesh[ID]Coord.dat”, “r”);
的Mesh[ID]Coord
意味着该ID整数应该插入那里。有小费吗?
提示是'sprintf' – bmargulies
使用'strcat'。示例:http://stackoverflow.com/questions/308695/c-string-concatenation –
@ l19 strcat无法在int上操作。 – nos