怎么样..?从文件中读取最后100个字节...? [英] how..? Read last 100 byte from file ...?

查看:91
本文介绍了怎么样..?从文件中读取最后100个字节...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家

我的问题是..



如何使用vb.net 2012从文件中读取最后100个字节的十六进制

然后将其插入文本框..

到目前为止我已经给出了下面给出的代码,但没有输出到文本框

everyone
my ques Is..

How to read last 100 bytes of hex from file using vb.net 2012
and then insert it into the textbox ..
so far i have given below given code but did'nt get output to textbox

Dim fs as new filestream(filepath,filemode.opem,fileaccess.readwrite)
fs.seek(100,seekorigin.end)
dim bytearray(100) as byte
dim numbytesread as integer=fs.read(bytearray,0,100)
textbox1.text=fs.tostring 


i want last 100 bytes to textbox
thnxxxs in advance

推荐答案

你应该尝试类似的东西:

You should try something similar to:
Dim fs As New FileStream(filepath, FileMode.Open, FileAccess.Read)
fs.Seek(-100, SeekOrigin.End)
Dim bytearray(100) As Byte
Dim numbytesread As Integer = fs.Read(bytearray, 0, 100)

textbox1.text = System.Text.Encoding.ASCII.GetString(bytearray)


这篇关于怎么样..?从文件中读取最后100个字节...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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