update
This commit is contained in:
@@ -53,4 +53,8 @@ dkms.conf
|
|||||||
|
|
||||||
# debug information files
|
# debug information files
|
||||||
*.dwo
|
*.dwo
|
||||||
|
|
||||||
|
# nuisible
|
||||||
C/Grace/tmp_Grace
|
C/Grace/tmp_Grace
|
||||||
|
C/Sully/Sully_*
|
||||||
|
C/Sully/Sully
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
.PHONY: all clean fclean re test
|
||||||
|
|
||||||
|
all: Sully
|
||||||
|
|
||||||
|
Sully: Sully.o
|
||||||
|
cc -g3 -o Sully Sully.o
|
||||||
|
|
||||||
|
Sully.o: Sully.c
|
||||||
|
cc -c -g3 Sully.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f Sully.o
|
||||||
|
|
||||||
|
fclean: clean
|
||||||
|
rm -f Sully
|
||||||
|
|
||||||
|
re: fclean all
|
||||||
|
|
||||||
|
test:
|
||||||
|
./Sully > tmp_Sully ; diff tmp_Sully Sully.c
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
int index = 5;
|
||||||
|
char filename[8];
|
||||||
|
char filename_source[10];
|
||||||
|
char* base_name_file = "Sully_";
|
||||||
|
char exec_filename[50];
|
||||||
|
snprintf(filename, 100, "%s%d", base_name_file, index);
|
||||||
|
snprintf(filename_source, 100, "%s.c", filename);
|
||||||
|
snprintf(exec_filename, 100, "cc %s -o %s", filename_source, filename);
|
||||||
|
if (index >= 0){
|
||||||
|
int fd = open(filename_source, O_CREAT, O_RDWR | S_IRWXU);
|
||||||
|
int ret_exec = execl(exec_filename, exec_filename, NULL);
|
||||||
|
//Compiler Sully_X.c ---> Sully_X
|
||||||
|
//Lancer le Sully_X.c
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user