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

满分求解!!在C#中如何按位读写,谢谢!!!!!!!!!!!!!!!!!
我现在需要按12位进行读写,请高手指点~谢谢

------解决方案--------------------

Stream fs = File.Open(filename, FileMode.Open);

fs.Seek(offset, SeekOrigin.Begin);

fs.Read(buf,0, 12);

------解决方案--------------------
bitarray
------解决方案--------------------
byte[] buffer = new byte[12];
Stream fs = null;
try
{
fs = new FileStream(filename, FileMode.Open,FileAccess.Read);
int count = fs.Read(buffer,0, buffer.Length);
while(count> 0)
{
//处理
count = fs.Read(buffer,0, buffer.Length);
}
}
finally
{
if(fs!=null)
fs.Close();
}