using this code to closer crash point identification, by logging important values, actions, changes;
in case of unknown, relocated errors and crashes etc.Working on linux, sometimes I had only short part of error log
and finding the problem takes a time.
(That's not new, people had posted many version of their error catchers)
So I searched a way to force writing to disk immediately;
after reading manual etc.., seems this code snippet is flushing buffer onto HDD as needed.
Code: Select all
#Include "vbcompat.bi"
#include "crt/stdio.bi" 'fflush function
dim shared elf2 as integer: elf2=freefile 'aka Error Log File, must be global
open file myErrorLogFileName for output as #elf2
'on various places in program...
write #elf2, debugInfoA,....,etc, etc 'with immediate flush
fflush(cast(FILE ptr, Cast( FILE Ptr, FileAttr( elf2, fbFileAttrHandle ))))
Code: Select all
(#Include "vbcompat.bi" 'or file.bi)
#include "crt.bi"
but previously mentioned
Code: Select all
#include "crt/stdio.bi"
compiles Ok & works too Ok