CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    create a new file with exclusive owner mode

    Hello everyone,


    I did some research for File.Create API to find some option which could be used to create a new file, with exclusive owner mode (e.g. other process/thread can not delete/open/modify when current thread keep the file open). But can not find it out.

    Could anyone let me know which option should I use or which API should I use?


    thanks in advance,
    George

  2. #2
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: create a new file with exclusive owner mode

    Should look at the "lock" statement.

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Re: create a new file with exclusive owner mode

    Thanks mariocatch,


    I am confused. Could you provide a link please? Which API do you mean?

    Quote Originally Posted by mariocatch
    Should look at the "lock" statement.

    regards,
    George

  4. #4
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: create a new file with exclusive owner mode

    type "lock" into your IDE and press F1. Or do an MSDN search for "lock".

  5. #5
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Re: create a new file with exclusive owner mode

    Thanks mariocatch,


    But lock does not provide cross-process exclusive control, right?

    Quote Originally Posted by mariocatch
    type "lock" into your IDE and press F1. Or do an MSDN search for "lock".

    regards,
    George

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: create a new file with exclusive owner mode

    Look at the FileShare enumeration used by the FileStream class.

    Another option is to use a named mutex and have each process lock/unlock the mutex.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured