ok, so apparently std::filesystem::last_write_time(file) will change before a file is finished being written to the disc, resulting in me getting a partial file if I try to read it right then. I don't have control over the program writing the file, just the one reading. Any fix?
-
-
I'm trying to hot-reload a text file whenever you change it. monitoring it continually for its "last write time" to change results in it alerting me that's its changed before it's finished changing, so trying to load it immediately gets me a broken or empty file.
-
I tried using windows APIs to lock the file, which had its own separate issue later on (loading the file via std:: after locking it with the windows API was getting me an old version of the file...)
- Show replies
New conversation -
-
-
Howdy, I was reading the MSDN docs on file time and was curious about the implications of the write time resolution. Doesn’t this mean file time cannot be trusted until after the 2s buffer period has passed?https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime …
-
it sounds like that's just for the FAT filesystem, google says NTFS file time resolution is 100ns
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.