使用c#字节数组中的数据 [英] Use the data in a c# byte array

查看:152
本文介绍了使用c#字节数组中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个图像,包括图像头,存储在c#字节数组(字节[])中.

头位于字节数组的开头.
如果将标头放在结构中(就像在c ++中一样),它看起来像这样:

Hello,

I have an image, including image header, stored in a c# byte array (byte []).

The header is at the beginning of the byte array.
If I put the header in a struct (as I did in c++) it looks like this:

typedef struct RS_IMAGE_HEADER
{
   long HeaderVersion;
   long Width;
   long Height;
   long NumberOfBands;
   long ColorDepth;
   long ImageType;
   long OriginalImageWidth;
   long OriginalImageHeight;
   long OffsetX;
   long OffsetY;
   long RESERVED[54];
   long Comment[64];

} RS_IMAGE_HEADER;




如何在C#中做到这一点,如何获取和使用图像标题(存储在字节数组开头的所有数据)中的所有数据?

谢谢




How can I do it in c#, how can I get and use all the data in the image header (that stored in the beginning of the byte array)?

Thanks

推荐答案

这里有一个例子:(您可能需要对它的确切结构进行一些调整)
http://stackoverflow.com/questions/2871/reading-acc-data-structure-in-c-sharp-from-a-byte-array [
There is an example here: (You may have to tweak it a bit for your exact structure)
http://stackoverflow.com/questions/2871/reading-a-c-c-data-structure-in-c-sharp-from-a-byte-array[^]


这篇关于使用c#字节数组中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆