My app opens a log file for writing on startup. It closes it (CloseHandle API) when the app exits. It writes lines to the log file as the program runs.
What I would like to do is open another handle to this file for just reading during the course of the program, to just display its contents to the screen. Is there a combination of flags for the openings (CreateFile) that will allow me to do this? Right now opening for reading fails.
Thanks.
VB Code:
'open for writing hFile = CreateFile(FixDir(App.Path) & LOGFILE, GENERIC_WRITE, FILE_SHARE_READ, _ ByVal 0&, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, 0) 'open for reading hRead = CreateFile(FixDir(App.Path) & LOGFILE, GENERIC_READ, FILE_SHARE_READ, _ ByVal 0&, OPEN_EXISTING, 0, 0)


Reply With Quote
