|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problems reading a text file in VB 6.0I am trying to read a text file with utf-8 encoding in Visual Basic 6.0. The
problem is that when I use the "Line Input" method, it gets more than what is really on the first line when I look at the file with a text editor. The same code works fine with VBScript, but I converted this code over to Visual Basic and now I cannot get it to work. I can send an example file to anyone if that would help. I am guessing that perhaps the Line Input method looks for a NewLine character but utf-8 encoding has these characters differently? This was working great in VBScript using the ReadLine method, but now I cannot get the same thing to work in VB. Also, I am using VB 6.0, not VB ..NET. Thanks in advance. I think I have some more info which may be helpful. Each line in my file
ends with a vbLf (not a vbCrLf or vbNewLine). So is there a way to use the Line Input command to read lines by Line feeds, not by new line characters? Or would it be better to read the entire file into a string and then sort that string based up Line feeds? Not quite sure how to approach this. Show quoteHide quote "TeABaG_" wrote: > I am trying to read a text file with utf-8 encoding in Visual Basic 6.0. The > problem is that when I use the "Line Input" method, it gets more than what is > really on the first line when I look at the file with a text editor. The > same code works fine with VBScript, but I converted this code over to Visual > Basic and now I cannot get it to work. I can send an example file to anyone > if that would help. I am guessing that perhaps the Line Input method looks > for a NewLine character but utf-8 encoding has these characters differently? > This was working great in VBScript using the ReadLine method, but now I > cannot get the same thing to work in VB. Also, I am using VB 6.0, not VB > .NET. Thanks in advance. Although your question is in the wrong newsgroup ( this is a VB.Net
newsgroup ) I can answer your question : You should use FSO ( file system object ) in VB6 to do what you want once i strugled with the same problem and decided to share the solution for my situation so look here http://www.devx.com/tips/Tip/22282 regards Michel Posseth [MCP] Show quoteHide quote "TeABaG_" wrote: > I am trying to read a text file with utf-8 encoding in Visual Basic 6.0. The > problem is that when I use the "Line Input" method, it gets more than what is > really on the first line when I look at the file with a text editor. The > same code works fine with VBScript, but I converted this code over to Visual > Basic and now I cannot get it to work. I can send an example file to anyone > if that would help. I am guessing that perhaps the Line Input method looks > for a NewLine character but utf-8 encoding has these characters differently? > This was working great in VBScript using the ReadLine method, but now I > cannot get the same thing to work in VB. Also, I am using VB 6.0, not VB > .NET. Thanks in advance.
Best way to get a Junior Programmer up to speed
Re: Is VB.NET Stable?? To Aaron Kemp - Ahole Extrordinare String to Byte & Vice Versa deployment of project migrating MSDE to SQLExpress End Processing in Multithreaded App Exposing Com Interfaces of a .Net Class Library (Trouble Regsvr32) Cross-thread operation not valid. catching close button Calculate inside a form and use the same form as Insert record form NNTP Question |
|||||||||||||||||||||||