11679.html

来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 26 行

HTML
26
字号
<html>
  <head>
    <title>To Xiao Wu and all: Unicode...</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>To Xiao Wu and all: Unicode...</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by wei on April 06, 1999 at 06:58:07:<p>
I have question regarding the unicode examples posted in the site: if the file is unicode formated(in Notepad.exe, save file as "unicode"), then the following code doesn't work properply as expected:<p> Private Sub Command1_Click ()<br>    Dim sFile As String<p>    'suppose filename.txt is unicode formated<p>    Open "C:\filename.txt" For Input As #1 <br>    sFile = Input$(LOF(1), #1)<br>    Close #1<br> End Sub<p>The msg is "input past end of file", and sFile=""<p>Same problem still remains if "sFile = Input$(LOF(1), #1)" is replaced by "sFile = StrConv(InputB$(LOF(1), #1), vbUnicode)".<p>Did I miss something here, so I got wrong results? :)<p>If the file is unicode formatted, how to get each line?<br>I used following statements:<br>  Open filename for input as #1<br>    Do While (Not EOF(1))<br>       Line Input #1, sLine<br>       'do something here to parse sLine <br>    Loop<br>  Close #1<br>then I can only get 50% lines.<p>Please help me!<p>Thank you very much!<p><br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 11679-->
<!--top: 11713--><li><a href="11713.html">Use binary mode to open unicode files</a> <b>小吴</b> <i>10:37:05 4/07/99</i>
(<!--responses: 11713-->0)
<ul><!--insert: 11713-->
</ul><!--end: 11713-->
</ul><!--end: 11679-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?