There were two parts to your question: creating a directory, and writing numbered files. Try the following (updated so the directory protection is set explicitly, that correct headers are included, and that one file is closed before the next one is opened):
#include <stdio.h>
#include <sys/stat.h>
int main(void) {
const char* myDirectory = "/Users/floris/newDirectory";
char fileName[256];
int ii, fErr;
FILE *fp;
fErr = mkdir(myDirectory, (mode_t)0700);
for(ii=0; ii< 10; ii++) {
sprintf(fileName, "%s/file%d.txt", myDirectory, ii);
if((fp = fopen(fileName, "w"))!=NULL) {
// do whatever you need to do
}
else {
printf("could not open %s\n", fileName);
}
fclose(fp);
}
return 0;
}