vb6 - Getting Error on while reading a blank text file? -
Use of VB6
When I am reading an empty text file, the file's input is in the form of the past Showing error in
Code
code
fileSystemObject Dim TS as TextStream Dim TempS string set as the final form string set fso = new FileSystemObject set TS = Fso.OpenTextFile (txtSourceDatabaseFile & amp; \ "and filename, for reading) final = ts.read ts. Atndoffstream temps = ts.redline final = last & amp; temps & vbcrlf loop ts.close
How to check if the text file is empty or not? If there is no need to read the blank content, then
You are doing this :
final = TS reads up to all T. At AndOffStream Templates = T.S. Redline Ultimate = Last & TempS & VbCrLf Loop
Before calling ReadAll, you should check at and endream, something like this:
If the TS interfstream then final = "" otherwise the final = ts.redl ts.at and offstream tempos = tA Kredlain final = final and amp; TempS & amp; VbCrLf loop and if
However as a note, you get an argument error there: ReadAll will read the entire file in memory. I will not return anything after reading the redline. Read either Use All and parse the input with string manipulation, or just call readlines. Do not use both.
Comments
Post a Comment