日期:2014-05-19  浏览次数:20797 次

关于BYTE数组地址的问题?
代码如下:
int   count=1024;
FileStream   fs   =   File.OpenRead(filePath);
byte[]   bytes   =   new   byte[1024   +   fs.Length];
fs.Read(bytes,   0,   (int)fs.Length);//   这里应该如何写?
我的原意是先分配了1024   +   fs.Length个字节,前面1024准备放入其他数据,读入的文件内容想放在1024后的数组地址里,这里应该怎么写呢?
在VC里就可以直接写成&bytes[1024],C#里如何写?
谢谢!


------解决方案--------------------
fs.Read(bytes, 1024, (int)fs.Length);
设置一下起始位置就可以了
------解决方案--------------------
fs.Seek(1024);