In windows-based OS, assuming there are several different processes that may read and/or write a file freqently by using fopen/fopen_s/fwrite etc, in such case, do I need to consider data-races, or the OS can handle this automatically to ensure the file can only be opened/updated by a single process here at any given time whilst the rest fopen attemp will fail? And what about linux-based OS on this matter?
In windows-based OS, assuming there are several different processes that may read and/or write
Share
In Windows it depends on how you open the file.
see some possible values for
uStyleparameter in case ofOpenFileanddwShareModein case ofCreateFile.Please note that
OpenFileis kind of deprecated though so better useCreateFile.