-
9fb3cff9 :Anonymous
2011-03-20 09:31
-
#include <unistd.h> //creat, write, close
//#include <strings.h> //strlen
static int f = 2;
static char n[2][9] = {"hello1.c", "hello2.c"};
static int s[2] = {61, 99};
static char d1[] =
#include "hello1.h"
;
static char d2[] =
#include "hello2.h"
;
static char *d[2] = {d1, d2};
int main(int argc, char* argv[])
{
int i, fd;
for (i=0; i<f; i++) {
fd = creat(n[i], 00644);
//write(fd, d[i], strlen(d[i]));
write(fd, d[i], s[i]);
//write(fd, d[i], sizeof(d[i]));
close(fd);
}
return 0;
}
これは構造体とかいうの使うべきなのか……。
エレガントな解法求む。
Powered by shinGETsu.