|
-
Jun 29th, 2005, 08:18 PM
#1
Thread Starter
Lively Member
Text file to listview, with premature EOF...
I have a decent sized list of lines which i load to a listview using a traditional list opening code (below). All works well, but encountering certian strings which are apparently EOF markers cut things off early leaving my list half empty.
VB Code:
Open "C:\FileCodeList.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, str1
If Left(str1,7)="KeepC:\" Then ListView1.ListItems.Add , , str1
Loop
Close #1
Ive read many articles on open as binary, but i cannot get any sort of list population going with that. Plus, i cannot store the entire file as a array due to its large size. From 1 to 150 MB.
Im not sure if i should somehow process the file before loading, removing or replacing all Null characters or EOF marking characters ( im not sure what they are) , or if there is a binary loop i can use to load this list successfully.
Amy help would be much appreciated. Thanks ahead of time.
Last edited by THCfog; Jun 29th, 2005 at 08:25 PM.
-
Jun 29th, 2005, 08:35 PM
#2
Re: Text file to listview, with premature EOF...
Could you attach a sample of your txt file for me to check your code?
-
Jun 30th, 2005, 03:53 AM
#3
Thread Starter
Lively Member
Re: Text file to listview, with premature EOF...
For a example of my error, add this to a text file in UNICODE format.
"KeepC:\FileName.txt;~Ty"
"KeepC:\FileName1.txt;‚Š~{"
"KeepC:\FileName3.txt;910w>"
"Success"
You will see it never reaches Success.
~ I have found that this error only happens when the file is in Unicode format. When i manually change it to ANSI or UTF-8, it loads. However some characters are then changed. Is there a way Open for input as UTF-8 or ANSI? Or if i was to convert the entire txt file to one of those 2 formats, a way to get it back to Unicode to see the original string while adding to the listview.
Thanks
-
Jun 30th, 2005, 04:57 AM
#4
Re: Text file to listview, with premature EOF...
Are you writing the file? Writing it normally from VB is in unicode isn't it?
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 30th, 2005, 05:07 AM
#5
Thread Starter
Lively Member
Re: Text file to listview, with premature EOF...
Im not writing any files or i wasnt... I think i might take the TYPE route , dynamic creating of batch files for a conversion. TYPE UNICODE > ASCI... I dont mind using batch commands to assist me in loading this list, so ill label this as semi-resolved for now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|