Added binary flag in test fopen calls and edited writechar in json.c