I have been coding VB6 since the TRex roamed the earth but suddenly some of our customers have started having problems with applications that have worked fine for decades.
The issues seems to be when a application repeatedly opens, appends and closes a file. I was never able to reproduce the error on any machine I had access to. I kind of guessed that this was the issue and changed the program to buffer the contents and write them all at once and the customers' problem seem to be resolved.
I have also, just recently, had a situation where lines were skipped and a line full of garbage characters was printed out. Like an old time C string buffer that had been allocated but never cleared.
The code is nothing special and standard VB6 file access code. My question is two parts. 1. Is this happening to anyone else? 2. If so, have you figured out the cause?
My guess at the cause is that the system is under some kind of resource strain and some deep level C code is misfiring.
Here is the code:
Dim nFileWrite As Integer
nFileWrite = FreeFile
Open fnAddBkSlash(sReadFilePath) & sWriteFileName For Append As #nFileWrite
Print #nFileWrite, sLineContents
Close nFileWrite