开发者

cout binary data

开发者 https://www.devze.com 2023-02-09 17:22 出处:网络
If this snippet of code saves an an开发者_如何学Go object/image to file. What would need to be modified for it to actually cout the image\'s binary data stream? Thanks!

If this snippet of code saves an an开发者_如何学Go object/image to file. What would need to be modified for it to actually cout the image's binary data stream? Thanks!

if (frame && frame->Contains(ID3FN_DATA))
  {
    cout << "*** extracting picture to file \"" << argv[2] << "\"...";
    frame->Field(ID3FN_DATA).ToFile(argv[2]);
    cout << "done" << endl;
  }


I'm not familiar with this library particularly, but the documentation on the website suggests that that once you have the ID3_Field object, you can get its raw binary size using ID3_Field::BinSize() and the raw bytes from ID3_Field::GetRawBinary(). Once you have these two parameters, you can write the binary data to any ostream, including cout, by calling

myOStream.write((char *)field->GetRawBinary(), field->BinSize());

I have no idea if this is going to work because I've never used this library, but at least intuitively this makes sense.

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号