
Repost: Removing EOF char from txt file
Well in C++ when I had this problem I used a function that does the following:
----------
Open file for input one character at a time
do
Read one character from the file
If integer value of character = -1
Discard char and exit loop
else
Do something with that character such as put into a buffer
end if
loop
close file
---------
I am not sure if that would translate well into VB, but I would imagine something like:
========
boolContinue = true
iLoop = 0
Open "file.txt" for input as #1
Do while boolContinue = true
myChar = Input (1,#1)
if myChar = -1 then
boolContinue = false
else
buffer(iLoop) = myChar
end if
loop
buffer(iLoop) = EOF // in C++ EOF = '\0' not sure what it is in VB
close #1
========
-Russ
Sorry, I had to correct my previous post as follows:
I need to delete an "EOF" character in the beginning of a text file I'm
using for input. Here is the string that it gets stuck after (in
quotes):
"D? ?"
How can I delete this character or just get past it? Visual Basic sees
one of these characters as an "end of line" character and will not let
me proceed with any further Line Inputs.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!