Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
key-value-store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Samarth Joshi
key-value-store
Commits
5c33d4c0
Commit
5c33d4c0
authored
Nov 10, 2020
by
Roshan Rabinarayan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added code to read config
parent
1162d1cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
config.txt
config.txt
+5
-0
temp.c
temp.c
+20
-4
No files found.
config.txt
0 → 100644
View file @
5c33d4c0
aasasdads=23
asdsadasdasdasd=29
asdsadasdasdasd=29
asdsadasdasdasd=29
asdsadasdasdasdasdasd=231
\ No newline at end of file
temp.c
View file @
5c33d4c0
...
@@ -142,6 +142,7 @@ off_t file_put(char *key,char *value)
...
@@ -142,6 +142,7 @@ off_t file_put(char *key,char *value)
}
}
int
main
()
int
main
()
{
{
/*
/*
define the array of file descriptors depending on the prefix
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
define the array of readCount as well as the semaphore (read x and write y) for the same
...
@@ -149,7 +150,7 @@ int main()
...
@@ -149,7 +150,7 @@ int main()
GET would use read lock
GET would use read lock
each write should return the line number
each write should return the line number
*/
*/
int
n2
=
0
;
/*
int n2=0;
char prevkey[256];
char prevkey[256];
memset(prevkey,0,sizeof(prevkey));
memset(prevkey,0,sizeof(prevkey));
memcpy(prevkey,"w",1);
memcpy(prevkey,"w",1);
...
@@ -183,9 +184,9 @@ int main()
...
@@ -183,9 +184,9 @@ int main()
}
}
i=0;
i=0;
*/
printf
(
"%d"
,
modulus
(
prevkey
,
256
,
2
));
//
printf("%d",modulus(prevkey,256,2));
printf
(
"%d"
,
modulus
(
newkey
,
256
,
2
));
//
printf("%d",modulus(newkey,256,2));
//offset = file_put("24", "value245");
//offset = file_put("24", "value245");
...
@@ -199,5 +200,20 @@ int main()
...
@@ -199,5 +200,20 @@ int main()
// printf("(%s)\n", value);
// printf("(%s)\n", value);
//file_del("21");
//file_del("21");
//printf("(%s)\n", value);
//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
]);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment