Menu

#6 Added function cJSON_CreateTrueFalseArray() to create array of true/false values

Unstable (example)
open
nobody
None
1
2013-08-12
2013-08-12
aeaton
No

I needed support for printing an array of true,false conditions. So here is what I came up with. Thanks for your effort!

/ cJSON.c /
cJSON cJSON_CreateTrueFalseArray(int true_false,int count) {int i;cJSON n=0,p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){if(true_false<span>[i] > 0){n=cJSON_CreateTrue();}else{n=cJSON_CreateFalse();}if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}

/ cJSON.h /
extern cJSON cJSON_CreateTrueFalseArray(int true_false,int count);

Discussion

  • aeaton

    aeaton - 2013-08-12

    EDIT: sourceforge messed up the formatting

     
  • aeaton

    aeaton - 2013-08-12

    EDIT: sourceforge messed up the formatting

     

Log in to post a comment.