-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson.h
More file actions
34 lines (28 loc) · 640 Bytes
/
Copy pathjson.h
File metadata and controls
34 lines (28 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/** Library of json functions */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Node node;
struct Node {
void* value;
node* next;
};
typedef struct Dictonary dict;
struct Dictonary {
node* head;
int size;
};
typedef struct KVPair kvp;
struct KVPair {
void* key;
void* value;
};
dict* create_dict();
int replace_head(dict* d, char* temp);
int add_to_dict(kvp* p, dict* d);
char* dict_to_string(dict* d);
int write_to_json(char* filename, dict* d);
dict* read_from_file(char* filename);
kvp* make_pair(void* key, void* value);
void clear_dictionary(dict* d);
char* num_to_string(void* num);