I am working on a program, which uses multiple std::ifstream
s for reading a binary file, one std::ifstream
for each thread. Now I need to know, if std::ofstream
is thread-safe on Windows and Linux for writing in a same file. I am using using only one std::ofstream
and using for multiple threads.
I am reading different blocks using using each thread and writing those block in output file using seekp()
and write()
. Currently it is working for me but whether it is problematic for big files.
Is std::ofstream
thread safe?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…