using System;
using System.IO;
class test
{
public static void Main(){
BinaryReader dataIn;
int item;
FileStream f;
Byte[] buf1=new Byte[1600000]; //int onhand;
//double cost;
///char ch;
try{
f=new FileStream("2.txt",FileMode.Create);
dataIn=new BinaryReader(new FileStream("hzk16.dat",FileMode.Open));
}catch(FileNotFoundException exc){
Console.WriteLine(exc.Message);
return;
}
try{
item=dataIn.Read(buf1,158048,32);
// f.Write(item);
for (int i=158048;i<158048+32 ;i++ )
{
Console.WriteLine(buf1[i]+" "+i);
}
Console.WriteLine("buf1的长度为:"+buf1.Length);
}catch(EndOfStreamException){
Console.WriteLine("items no found.");
}
catch(IOException exc){
Console.WriteLine(exc.Message);
}
Console.ReadLine();
}
};158048 是“赵”在二进制文件中的起始位置,可程序就是读不出东西
using System.IO;
class test
{
public static void Main(){
BinaryReader dataIn;
int item;
FileStream f;
Byte[] buf1=new Byte[1600000]; //int onhand;
//double cost;
///char ch;
try{
f=new FileStream("2.txt",FileMode.Create);
dataIn=new BinaryReader(new FileStream("hzk16.dat",FileMode.Open));
}catch(FileNotFoundException exc){
Console.WriteLine(exc.Message);
return;
}
try{
item=dataIn.Read(buf1,158048,32);
// f.Write(item);
for (int i=158048;i<158048+32 ;i++ )
{
Console.WriteLine(buf1[i]+" "+i);
}
Console.WriteLine("buf1的长度为:"+buf1.Length);
}catch(EndOfStreamException){
Console.WriteLine("items no found.");
}
catch(IOException exc){
Console.WriteLine(exc.Message);
}
Console.ReadLine();
}
};158048 是“赵”在二进制文件中的起始位置,可程序就是读不出东西
解决方案 »
- 使用Attribute的好处是什么
- 请教哪位仁兄有比较好的c#俄罗斯方块源码
- 微软的RDLC报表组件是否包含了数据填报功能?
- 关于异步等待的问题,求求大家指点下
- 在dataGridView里选定一行记录,如何将选定记录里的各项值传到对应的TextBox里?
- datagrid重赋值问题
- 新手上路,串口收到的数据转换
- 查找Excel中的Sheet。
- 有一个Picturebox,设为透明,parent是窗体,窗体上还有一个panel,怎么把覆盖的panel部分画到picturebox上
- C#VS2010 progressBar1中添加label控件,使label的背景色透明即跟进度条的背景色一样(而不是from的背景色)
- 请问一个关于连接数据库字符串的问题。。。
- 请教:怎样获取RichTextBox中的URL链接?
byte[] desBytes = new byte[fs.Length];
fs.Read(desBytes, 0, desBytes.Length);
fs.Close();
desBytes就是你文件的内容
上月我刚做好一个这样的程序,不过不是从字库里读,因为这样局限性太大。
我用的方法是把文字画在bitmap上,然后再按行列读取点数据。
这样很方便可以制作16*16、24*24甚至16*24、15*29等非标准字模