title: C++ - How to have multiple threads write to a file
body: <p>I am currently writing a c++ program that uses threads to write strings to a file. I am using ofstream to write these strings, and I noticed that only one of the threads has access to the file.</p>
  <p>So my question: Is there any way to use ofstream in different threads to write to the same file?</p>
  <p>If it is possible, any examples would be great. If not, please let me know that as well, and some ways to get around this would be great.
  I have looked at the following link, except it didn't really make sense to me:
  <a href="https://stackoverflow.com/questions/7565034/can-multiple-threads-write-into-a-file-simultaneously-if-all-the-threads-are-wr">Can multiple threads write into a file simultaneously, if all the threads are writing to different locations?</a></p>