diff options
author | Joshua Allen <axlecrusher@gmail.com> | 2017-02-27 20:52:26 -0500 |
---|---|---|
committer | Joshua Allen <axlecrusher@gmail.com> | 2017-02-27 20:52:26 -0500 |
commit | e8d696e03128242be33eb0734addee645e894635 (patch) | |
tree | c099479bef1f196e8bf96cb6a25d4bbecf6ba601 /redist | |
parent | f78983a584768a54503535be0366b07c97738299 (diff) | |
download | libsurvive-e8d696e03128242be33eb0734addee645e894635.tar.gz libsurvive-e8d696e03128242be33eb0734addee645e894635.tar.bz2 |
basic config can be written to file
Diffstat (limited to 'redist')
-rw-r--r-- | redist/json_helpers.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/redist/json_helpers.c b/redist/json_helpers.c index e96e873..74028b2 100644 --- a/redist/json_helpers.c +++ b/redist/json_helpers.c @@ -3,6 +3,7 @@ #define _GNU_SOURCE #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "json_helpers.h" @@ -22,7 +23,7 @@ void json_write_float_array(FILE* f, const char* tag, float* v, uint8_t count) { str1=str2; str2=NULL; } - asprintf(&str2, "%s]\n", str1,v[i]); + asprintf(&str2, "%s]", str1,v[i]); fputs(str2,f); free(str1); free(str2); @@ -44,20 +45,20 @@ void json_write_double_array(FILE* f, const char* tag, double* v, uint8_t count) str1=str2; str2=NULL; } - asprintf(&str2, "%s]\n", str1,v[i]); + asprintf(&str2, "%s]", str1,v[i]); fputs(str2,f); free(str1); free(str2); } void json_write_uint32(FILE* f, const char* tag, uint32_t v) { - fprintf(f, "\"%s\":\"%d\"\n", tag, v); + fprintf(f, "\"%s\":\"%d\"", tag, v); } void json_write_float(FILE* f, const char* tag, float v) { - fprintf(f, "\"%s\":\"%f\"\n", tag, v); + fprintf(f, "\"%s\":\"%f\"", tag, v); } void json_write_str(FILE* f, const char* tag, const char* v) { - fprintf(f, "\"%s\":\"%s\"\n", tag, v); + fprintf(f, "\"%s\":\"%s\"", tag, v); }
\ No newline at end of file |