How does one insert an EOF marker in a text file?
My VB program creates a text file that a third party app reads. Unless I open it up in notepad and save it, the third party app gives incorrect results. Could it be the EOF marker?
Printable View
How does one insert an EOF marker in a text file?
My VB program creates a text file that a third party app reads. Unless I open it up in notepad and save it, the third party app gives incorrect results. Could it be the EOF marker?
as I'm told EOF markers are NOT really used
touched on it briefly years ago
add a record with a unique existance
ie>
Record = XXENDXX
then use an if statement in your code
if record = XXENDXX then do whatever
'count files in a directory
public iFiles As Integer
Dim sDir As String
'set your own specs for file pattern
sDir = Dir("C:\*.*", vbNormal + vbHidden + vbArchive + vbReadOnly + vbSystem)
While sDir <> ""
iFiles = iFiles + 1
sDir = Dir
Wend
'when you use the file use a loop
do while myVar <> iFiles
'bla bla
loop
when you reach the count you stop processing
EOF "End Of File" IS what returns if a opened filenumber location (loc) is higher that (lof) length of file. That happens usually when you use input# and past the end of file and get that error.
You cannot put a EOF marker, it's a VB function.
The End of a text file is represented by ascii character #26. Just check the QBasic help file. If you have a do until EOF and the loop comes across this character it sees it as the end of the file and stops.