simultaneous file writing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvjohn100
    New Member
    • Mar 2008
    • 57

    simultaneous file writing

    hello friends

    how can I write into file :- the problem is, it wanted to be accessed same time by more than one user.... any solution using buffer or something like that........... .......... thanks

    John
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by mvjohn100
    hello friends

    how can I write into file :- the problem is, it wanted to be accessed same time by more than one user.... any solution using buffer or something like that........... .......... thanks

    John
    i think you have to start using semaphores or mutex lock to acquire the lock and write to the file

    Raghuram

    Comment

    • mvjohn100
      New Member
      • Mar 2008
      • 57

      #3
      hello,

      what about c++ "fstream" object. Is it handle the multiple access. I want to store the errors generated in the programs in a file; the errors may be from many threads....

      thanks
      john

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        See http://msdn2.microsoft.com/en-us/lib...3b(VS.80).aspx. Your compiler should have a way of compiling a thread safe version of the C++ library.

        Comment

        • mvjohn100
          New Member
          • Mar 2008
          • 57

          #5
          we using gcc in linux platform. Is this complier thread safe in default for C++ library. Is we want to add any options.....

          Thanks
          john

          Comment

          • Sick0Fant
            New Member
            • Feb 2008
            • 121

            #6
            Look at shared memory. I believe linux has the shmget() function.

            Comment

            Working...