mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
test.c: remove file related code
This commit is contained in:
parent
bb60d6def5
commit
86be961bb5
39
test.c
39
test.c
@ -45,37 +45,6 @@ static void doit(char *text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Read a file, parse, render back, etc. */
|
|
||||||
static void dofile(char *filename)
|
|
||||||
{
|
|
||||||
FILE *f = NULL;
|
|
||||||
long len = 0;
|
|
||||||
char *data = NULL;
|
|
||||||
|
|
||||||
/* open in read binary mode */
|
|
||||||
f = fopen(filename,"rb");
|
|
||||||
/* get the length */
|
|
||||||
fseek(f, 0, SEEK_END);
|
|
||||||
len = ftell(f);
|
|
||||||
fseek(f, 0, SEEK_SET);
|
|
||||||
|
|
||||||
data = (char*)malloc(len + 1);
|
|
||||||
if (data == NULL)
|
|
||||||
{
|
|
||||||
printf("Failed to allocate memory.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fread(data, 1, len, f);
|
|
||||||
data[len] = '\0';
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
doit(data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Used by some code below as an example datatype. */
|
/* Used by some code below as an example datatype. */
|
||||||
struct record
|
struct record
|
||||||
{
|
{
|
||||||
@ -393,14 +362,6 @@ int main(void)
|
|||||||
doit(text5);
|
doit(text5);
|
||||||
doit(text6);
|
doit(text6);
|
||||||
|
|
||||||
/* Parse standard testfiles: */
|
|
||||||
/* dofile("../../tests/test1"); */
|
|
||||||
/* dofile("../../tests/test2"); */
|
|
||||||
/* dofile("../../tests/test3"); */
|
|
||||||
/* dofile("../../tests/test4"); */
|
|
||||||
/* dofile("../../tests/test5"); */
|
|
||||||
/* dofile("../../tests/test6"); */
|
|
||||||
|
|
||||||
/* Now some samplecode for building objects concisely: */
|
/* Now some samplecode for building objects concisely: */
|
||||||
create_objects();
|
create_objects();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user