你用的是什么方法啊。 你应该用get 语句。 你用的那种是对顺序文件的方法。不是二进制!!!! 代码应该是这样的。 dim FileLen as long dim FileNo as integer dim FileStr as string fileno=freefile open filename for binary as fileno filelen=lof(fileno) FileStr=space(filelen) get #fileno,,filestr close fileno text1.text=Filestr
to pp616(平平) 你的方法也有同样问题!而且我剔除字符就不太好办了!还请各位大侠多指教!
dim iFile as integer dim bBit() as byteifile=freefileopen "c:\myfile.ext" for binary as #ifile redim bBit(lof(ifile)-1) get #ifile,,bBit close #ifile text1.text=strconv(bBit,vbUnicode)
dim iFile as integer dim bBit() as byteifile=freefileopen "c:\myfile.ext" for binary as #ifile redim bBit(lof(ifile)-1) get #ifile,,bBit close #ifile text1.text=strconv(bBit,vbUnicode)
如果不是,那问题就不在textbox,(可以改一下txt的类型,比如改成变体);如果是,那你可能是碰到鬼了,建议安装最新的补丁!(可是补丁中也没有说有此类问题呀,所以我还是想你碰到鬼了!)
line input #1,txtstr
text1.text=text1.text & txtstr & chr(13) & chr(10)
loop另外,你这个loc(1)是不是有问题~
to gameboy999(什么才是对的?)
问题关键在于为什么运行text1.text=txt
后len(text1)<len(txt)!
我定义txt是一个string!应该没问题吧!
我也想过!可先要找出错误的原因吧!
你可以使用 RichTextBox 代替!
2.如果试过了,问题解决了吗?
3.如果没有解决,那就是说还不知道问题在那里 else 问题就是出在textbox. 另外,你的vb是什么版本?
打开的文件绝对小于32k!
to DullMan(天灵)
我试一下吧!
那就会出现截取
出现"\0"的原因很简单,因为你是用binary方式打开的.
所以,你必须写一个转换函数,
每次遇到chr(0)的时候,把它换成别的没有特殊意义的字就行了
再说,line input好象应该用在用text方式打开的文件上对于二进制,则应该用get读取,put写入
所以~~~
还是要看你到底想做什么
这是一个较特殊的文件,我想剔除一些无法打印、显示的字符,并重新编排格式!
你应该用get 语句。
你用的那种是对顺序文件的方法。不是二进制!!!!
代码应该是这样的。
dim FileLen as long
dim FileNo as integer
dim FileStr as string
fileno=freefile
open filename for binary as fileno
filelen=lof(fileno)
FileStr=space(filelen)
get #fileno,,filestr
close fileno
text1.text=Filestr
你的方法也有同样问题!而且我剔除字符就不太好办了!还请各位大侠多指教!
dim bBit() as byteifile=freefileopen "c:\myfile.ext" for binary as #ifile
redim bBit(lof(ifile)-1)
get #ifile,,bBit
close #ifile
text1.text=strconv(bBit,vbUnicode)
dim bBit() as byteifile=freefileopen "c:\myfile.ext" for binary as #ifile
redim bBit(lof(ifile)-1)
get #ifile,,bBit
close #ifile
text1.text=strconv(bBit,vbUnicode)
那你就用"enmity"的方法吧。用字节数组来读。要是再出错。
那你就改考虑考虑把你那机器砸了!!明摆着是机器和你作对哦!!!
可能是我的文件中含有大量无法打印的字符造成的!
问题没解决,分还是给了吧!
各位若有兴趣,可以留下mail,我把文件发给你们,帮忙分析!