-
Handle two programs writing to the same file in C++? Help?
Hi, how to synchronize two cgi programs called
from browser, and write data to the same file
at the same time in C++?
Thank you very much,
Natxie
-
Senior Member
WHY??? And how are you at Shared Memory?
Banti
-
Hi, here's the more info:
It's a cgi prgram which read a file, and change some data in it, then write to the same file.
There's a possibility that two users access the
same cgi program at the same time, then write to
the same file at the same time, that caused
problem.
Is there's a way to handle it in C++?
Thanks,
Natxie
Last edited by natxie; 09-20-2001 at 06:05 PM.
-
Banned
concurrency is your problem. you have more than one 'user' trying to write to the same file at the same time, not good.
Now is your question about CGI or C++?
Either way, minimize your file IO. Only write to file when absolutely necessary, then open, write, close as fast as possible.
Why are you using file? Sounds like you need a DB.
-
I'm pretty sure c++ lets you lock your file as well, lock -> write/read -> unlock, but you might have already tried that. Not sure if it would do much or not, but I believe thats what the intention of the lock is! (mebbe, mebbe not!)
...you can look into semaphors if you want also!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke
|
Bookmarks