IT

Discussion in 'C++' started by nazrth8591@gmail.com, Sep 15, 2006.

  1. Guest

    Hi im trying to have the same file open in access on two different
    pc's. So that when the users input data on one it well update the file
    so it well show up on the other pc and vaice verse.

    can any one PLEASE HELP ME!!!
    thank you

    Michael
    , Sep 15, 2006
    #1
    1. Advertising

  2. Phlip Guest

    nazrth8591 wrote:

    > Hi im trying to have the same file open in access on two different
    > pc's. So that when the users input data on one it well update the file
    > so it well show up on the other pc and vaice verse.


    Trivially replace your Access interfaces with Ruby on Rails, running on a
    lite web server.

    (And because this newsgroup doesn't discuss Access databases, I'm allowed to
    recommend that! This group is only qualified to discuss raw C++ itself. Try
    an Access newsgroup!)

    --
    Phlip
    http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
    Phlip, Sep 15, 2006
    #2
    1. Advertising

  3. wrote:
    > Hi im trying to have the same file open in access on two different
    > pc's. So that when the users input data on one it well update the
    > file so it well show up on the other pc and vaice verse.
    >
    > can any one PLEASE HELP ME!!!


    I don't think it's a language problem. If your PCs run the operating
    systems that allow networking, you should be able to specify the
    location of the same file on each of them (it could reside on one of
    the systems or on an independent server altogether). The fact that
    access to that file has to be _shared_ has nothing to do with the
    language. It is achieved through operating system mechanisms, that's
    why you need to ask in the newsgroup dedicated to your OS.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Sep 16, 2006
    #3
  4. On Sat, 16 Sep 2006 11:21:01 -0400, "Victor Bazarov"
    <> wrote:
    > wrote:
    >> Hi im trying to have the same file open in access on two different
    >> pc's. So that when the users input data on one it well update the
    >> file so it well show up on the other pc and vaice verse.

    >
    >I don't think it's a language problem. If your PCs run the operating
    >systems that allow networking, you should be able to specify the
    >location of the same file on each of them (it could reside on one of
    >the systems or on an independent server altogether). The fact that
    >access to that file has to be _shared_ has nothing to do with the
    >language. It is achieved through operating system mechanisms, that's
    >why you need to ask in the newsgroup dedicated to your OS.


    It's more a design than an OS problem. The challenge is to ensure that
    at the same time only one process accesses the file. It's tedious but
    it can (almost) be done in C++ with a lock file. The sketch of a
    soulution is presented here:
    http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=144&rl=1
    .. The solution is incomplete because it doesn't address "if a process
    that holds the lock terminates before releasing it".
    I have implemented something similar but would not recommend it.
    Better use other 'collaborative' protocols (eg. each process writes to
    its own file which can be read (but not modified) by all other
    processes).

    Best regards,
    Roland Pibinger
    Roland Pibinger, Sep 17, 2006
    #4
  5. Guest

    Roland Pibinger wrote:
    > On Sat, 16 Sep 2006 11:21:01 -0400, "Victor Bazarov"
    > <> wrote:
    > > wrote:
    > >> Hi im trying to have the same file open in access on two different
    > >> pc's. So that when the users input data on one it well update the
    > >> file so it well show up on the other pc and vaice verse.


    > It's more a design than an OS problem. The challenge is to ensure that
    > at the same time only one process accesses the file. It's tedious but
    > it can (almost) be done in C++ with a lock file. The sketch of a
    > soulution is presented here:
    > http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=144&rl=1
    > . The solution is incomplete because it doesn't address "if a process
    > that holds the lock terminates before releasing it".


    Well, that's easily added? Make a global of class type and have the
    dtor clean
    up. Of course, in the presence of UB that might not work. In the
    presence of
    UB, *any* C++ construct may fail, so I don't consider it a on-topic
    objection.

    HTH,
    Michiel Salters
    , Sep 18, 2006
    #5
  6. On 18 Sep 2006 05:15:54 -0700, wrote:
    >Roland Pibinger wrote:
    >> it can (almost) be done in C++ with a lock file. The sketch of a
    >> soulution is presented here:
    >> http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=144&rl=1
    >> . The solution is incomplete because it doesn't address "if a process
    >> that holds the lock terminates before releasing it".

    >
    >Well, that's easily added? Make a global of class type and have the
    >dtor clean up. Of course, in the presence of UB that might not work. In the
    >presence of UB, *any* C++ construct may fail, so I don't consider it a
    >on-topic objection.


    When the process that holds the lock file is terminated unexpectedly
    someone has to clean up the situation, ie. programmatically, another
    process must delete the lock file and create its own. So the lock file
    needs to expire after some time. Then several processes simultanously
    try to delete and recreate the lock file. In order to avoid any race
    condition a process must create a lock file for the expired lock file
    before it can safely delete and recreate it. A 100% safe solution is
    not that easy ...
    BTW, not only 'UB' can terminate a process. Some operating systems
    'freeze' at times or the electric power is simply turned off
    inadvertently.

    Best wishes,
    Roland Pibinger
    Roland Pibinger, Sep 18, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page