Dados binários JSONCPP

Eu estou tentando usar JSON cpp com VS2008.

Alguém pode me dizer é possível para embalar dados binários em formato JSON? Eu estou lendo um arquivo de imagem emchar* buffere colocá-lo emJSON::Value. Mas quando tento analisá-lo, não encontro o conteúdo do buffer no objeto JSON.

Código é o seguinte.

    Json::Value root;
    Json::Reader reader;
    Json::StyledWriter writer;
    int length;
    char * buffer;
    ifstream is;
    is.open ("D:\\test.j2k", ios::binary);

    // get length of file:
    is.seekg (0, ios::end);
    length = is.tellg();
    is.seekg (0, ios::beg);

    // allocate memory:
    buffer = new char [length];

    // read data as a block:
    is.read (buffer,length);
    root["sample"] = *buffer;
    writer.write(root);  
    cout << root;
    const string rootAsString  = root.toStyledString();
    cout << rootAsString << endl;

Como sou novo no VC ++, não tenho certeza se a leitura de um arquivo de imagem para o char * buffer está correta / errada. Por favor, deixe-me saber o que há de errado com o código. Obrigado.

questionAnswers(1)

yourAnswerToTheQuestion