Commit 5c33d4c0 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added code to read config

parent 1162d1cd
aasasdads=23
asdsadasdasdasd=29
asdsadasdasdasd=29
asdsadasdasdasd=29
asdsadasdasdasdasdasd=231
\ No newline at end of file
......@@ -142,6 +142,7 @@ off_t file_put(char *key,char *value)
}
int main()
{
/*
define the array of file descriptors depending on the prefix
define the array of readCount as well as the semaphore (read x and write y) for the same
......@@ -149,7 +150,7 @@ int main()
GET would use read lock
each write should return the line number
*/
int n2=0;
/* int n2=0;
char prevkey[256];
memset(prevkey,0,sizeof(prevkey));
memcpy(prevkey,"w",1);
......@@ -183,9 +184,9 @@ int main()
}
i=0;
printf("%d",modulus(prevkey,256,2));
printf("%d",modulus(newkey,256,2));
*/
//printf("%d",modulus(prevkey,256,2));
//printf("%d",modulus(newkey,256,2));
//offset = file_put("24", "value245");
......@@ -199,5 +200,20 @@ int main()
// printf("(%s)\n", value);
//file_del("21");
//printf("(%s)\n", value);
FILE *fp = fopen("config.txt","r");
char *line;
off_t len=0;
char* arrParam[20];
char* arrValue[20];
int k=0;
while(getline(&line,&len,fp)!=-1)
{
char *param=strtok(line,"=");
char *value =strtok(NULL,"=");
arrParam[k]=param;
arrValue[k++]=value;
printf("%s:%s",arrParam[k-1],arrValue[k-1]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment