simplified getting content of fileBuffer in checkVersion
i have no idea why it was like that
This commit is contained in:
parent
7714e45019
commit
96945a4d31
@ -52,25 +52,24 @@ void checkVersion(inputFlags flags)
|
|||||||
|
|
||||||
//JSON VARIABLES
|
//JSON VARIABLES
|
||||||
char *buffer;
|
char *buffer;
|
||||||
char lineBuffer[32];
|
|
||||||
struct json_object *parsedJson;
|
struct json_object *parsedJson;
|
||||||
struct json_object *active;
|
struct json_object *active;
|
||||||
|
int bufferSize;
|
||||||
|
|
||||||
//COUNT LENGTH OF buffer
|
//COUNT LENGTH OF buffer AND STORE IT IN bufferSize
|
||||||
fileBuffer = fopen(VERSIONS_NAME, "r");
|
fileBuffer = fopen(VERSIONS_NAME, "r");
|
||||||
fseek(fileBuffer, 0, SEEK_END);
|
fseek(fileBuffer, 0, SEEK_END);
|
||||||
buffer = malloc(ftell(fileBuffer));
|
bufferSize = ftell(fileBuffer);
|
||||||
|
|
||||||
rewind(fileBuffer); //REWIND fileBuffer (NO SHIT)
|
rewind(fileBuffer); //REWIND fileBuffer (NO SHIT)
|
||||||
|
|
||||||
|
//SET LENGTH OF buffer
|
||||||
|
buffer = malloc(bufferSize);
|
||||||
|
|
||||||
//FIX buffer
|
//FIX buffer
|
||||||
strcpy(buffer, "");
|
strcpy(buffer, "");
|
||||||
|
|
||||||
//LOAD jsonFile
|
//LOAD jsonFile
|
||||||
while (fgets(lineBuffer, sizeof(lineBuffer), fileBuffer) != NULL)
|
fread(buffer, bufferSize, 1, fileBuffer);
|
||||||
{
|
|
||||||
strcat(buffer, lineBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CHECK FOR TEXT IN buffer
|
//CHECK FOR TEXT IN buffer
|
||||||
if (strcmp(buffer, "") == 0)
|
if (strcmp(buffer, "") == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user