add config
This commit is contained in:
parent
39b0ed19ae
commit
c06d9ea962
5
config
Normal file
5
config
Normal file
@ -0,0 +1,5 @@
|
||||
/systemd/blalbla/1
|
||||
/systemd/blalbla/2
|
||||
/systemd/blalbla/3
|
||||
/systemd/blalbla/4
|
||||
/systemd/blalbla/5
|
37
config.c
Normal file
37
config.c
Normal file
@ -0,0 +1,37 @@
|
||||
#include"config.h"
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include<stdbool.h>
|
||||
|
||||
int loadConfig(char *file, char **str_entry,int size)
|
||||
{
|
||||
int i=0;
|
||||
bool terminate=false;
|
||||
FILE *f_config;
|
||||
|
||||
printf("opening config file\n");
|
||||
f_config = fopen("config","r");
|
||||
if(f_config != NULL)
|
||||
{
|
||||
for(i=0;i<size & terminate==false;i++)
|
||||
{
|
||||
printf("for loop:%d",i);
|
||||
if(fgets(str_entry[i],10,f_config)!=NULL)
|
||||
{
|
||||
puts(str_entry[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
terminate = true;
|
||||
fclose(f_config);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"error opening file");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user