diff options
author | Przemyslaw <prymula76@outlook.com> | 2024-04-01 09:10:43 +0200 |
---|---|---|
committer | Przemyslaw <prymula76@outlook.com> | 2024-04-01 09:10:43 +0200 |
commit | 74a88f882ea83593d727e7031e20791349c013cd (patch) | |
tree | 52a6f3893db6bf3c34de11d1e692ad5957c7bcb3 /wrapper-icon/wrapper.c |
Diffstat (limited to 'wrapper-icon/wrapper.c')
-rw-r--r-- | wrapper-icon/wrapper.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/wrapper-icon/wrapper.c b/wrapper-icon/wrapper.c new file mode 100644 index 0000000..5ea19f8 --- /dev/null +++ b/wrapper-icon/wrapper.c @@ -0,0 +1,71 @@ +#include <stdio.h> // printf
+#include <stdlib.h> // exit
+#include <string.h>
+#include <unistd.h> // sleep access
+
+/*
+char * current(char * name){
+ char *file;
+
+ if (!getenv("CD")) {
+ printf ("Zmienna srodowiskowa \"CD\" nie istnieje !\n");
+ exit (1);
+ }
+ file=malloc(strlen(getenv("CD")+strlen(name)+1));
+ strcpy(file, getenv("CD"));
+ strcat(file, name);
+
+ return file;
+}
+*/
+
+char * file_exist(){
+ char * name = (char *)".\\config.txt";
+ //char *file = current(name);
+ char *file = name;
+
+ if (access(file, F_OK)==0){
+ printf("PLIK istnieje %s\n",file);
+ free(file);
+ return file;
+ }
+ printf("PLIK nie istnieje %s\n",file);
+ free(file);
+ return NULL;
+}
+
+
+
+void load(){
+
+ char * file = file_exist();
+ char bufor1[128];
+ char bufor2[128];
+ char bufor3[128];
+ char run[384];
+
+ if (!file) exit(1);
+
+ FILE * f = fopen(file, "r");
+ fscanf(f, "%s %s %s", bufor1,bufor2,bufor3);
+ fclose(f);
+ strcpy(run, bufor1);
+ strcat(run, " ");
+ strcat(run, bufor2);
+ strcat(run, " ");
+ strcat(run, bufor3);
+ printf("Uruchamiam %s \n",run);
+ free(file);
+
+ system(run);
+
+
+
+
+}
+
+int main (){
+ load();
+
+ return 0;
+}
|