-
a7b48603 :Anonymous
2011-03-20 12:57
-
>>9fb3cff9
結局こんなんなった。
#include <unistd.h> //creat, write, close
#define DIRS 1
#define FILES 2
#define MAXDIRLEN 4
#define MAXPATH 13
static char d[DIRS][MAXDIRLEN+1] = {"test"};
static char n[FILES][MAXPATH+1] = {"test/hello1.c", "test/hello2.c"};
static char v1[] =
#include "hello1.h"
;
static char v2[] =
#include "hello2.h"
;
static char *v[FILES] = {v1, v2};
int strlen(char *s);
int strlen(char *s)
{
int i;
for (i=0; s[i] != '\0'; i++);
return i;
}
int main(int argc, char* argv[])
{
int i, fd;
for (i=0; i<DIRS; i++) {
write(1, d[i], strlen(d[i]));
write(1, "/\n", 2);
mkdir(d[i], 00755);
}
for (i=0; i<FILES; i++) {
write(1, n[i], strlen(n[i]));
write(1, "\n", 1);
fd = creat(n[i], 00644);
write(fd, v[i], strlen(v[i]));
close(fd);
}
return 0;
}
Powered by shinGETsu.