Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. my problem is related to file handling

my problem is related to file handling

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadminalgorithmshelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rajneshmalik
    wrote on last edited by
    #1

    i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance

    N I 2 Replies Last reply
    0
    • R rajneshmalik

      i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      One solution may be sending a parameter when client ends working with file. Another possibility (but I don't know if that is ok for you) is to use the "share priviliges" flags of the file. You can create the file to be used only by one application or by more as you want. Another one would be create another empty file that just hold the name of the first one + _busy or something like that, and deleting that sec file after ending the work with the first one. P.S. there must most probably be better solutions, my knowledge is limited, this is just a logic think.

      Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

      modified on Wednesday, December 19, 2007 4:22:20 AM

      1 Reply Last reply
      0
      • R rajneshmalik

        i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using FindFirstChangeNotification etc for this job. Iain.

        N D 2 Replies Last reply
        0
        • I Iain Clarke Warrior Programmer

          Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using FindFirstChangeNotification etc for this job. Iain.

          N Offline
          N Offline
          Nelek
          wrote on last edited by
          #4

          Iain Clarke wrote:

          Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file.

          I suppose that is an irony to say my solutions suck. For next times, I prefer a simple "this is bad, is better that". I know I am limited, but I try and from corrections like yours

          Iain Clarke wrote:

          I trust you're using FindFirstChangeNotification etc for this job

          I learn too.

          Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

          1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using FindFirstChangeNotification etc for this job. Iain.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Iain Clarke wrote:

            I hope the server is not in a loop continouusly checking for the file...

            That's what his "server is continuously searching that directory" comment is implying.

            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups