473,396 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

File Locking

dfound
52
Hi, I am using Turbo C++ and is thinking of creating a program that would lock files. Since I am a newbie , I can't figure out how to lock the files. I am not talking about denying sharing , what I want is that when the file is being tried to open , it must show an error message or it should not open at all..

Hope that I will get replies
:-)
Jan 21 '07 #1
4 1978
willakawill
1,646 1GB
Hi, I am using Turbo C++ and is thinking of creating a program that would lock files. Since I am a newbie , I can't figure out how to lock the files. I am not talking about denying sharing , what I want is that when the file is being tried to open , it must show an error message or it should not open at all..

Hope that I will get replies
:-)
Other than causing irritation to other users, what reason do you have for locking files? What type of file are you trying to lock?
Jan 21 '07 #2
horace1
1,510 Expert 1GB
Hi, I am using Turbo C++ and is thinking of creating a program that would lock files. Since I am a newbie , I can't figure out how to lock the files. I am not talking about denying sharing , what I want is that when the file is being tried to open , it must show an error message or it should not open at all..

Hope that I will get replies
:-)
the simplest way would be to make the files read only
Jan 21 '07 #3
dfound
52
Well I am trying to lock some of my private documents. So , I cannot just make it a read-only. People shouldnot be able to open or see those files except for me. How can I do it?
Jan 22 '07 #4
horace1
1,510 Expert 1GB
Well I am trying to lock some of my private documents. So , I cannot just make it a read-only. People shouldnot be able to open or see those files except for me. How can I do it?
you need to change the access rights so that no one but the owner can access the files
.e.g the chmod command in unix
chmod 700 file.txt

there is a function _chmod() in the windows C library which appears to do a similar thing (I have never used it though)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__chmod.2c_._wchmod.asp

under windows there is also the cacls command line tool
http://www.ss64.com/nt/cacls.html
Jan 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Geoffrey | last post by:
We have developed a python class that can read data files created from another application. These target files are C-ISAM files used for accounting applications so the "primary" application may be...
2
by: Kamus of Kadizhar | last post by:
Thanks to Robert Brewer, I got enough insight into logging to make it work.... Now I have another issue: file locking. Sorry if this is a very basic question, but I can't find a handy reference...
3
by: Hugz | last post by:
Hello, And Thank you for taking time to help me.Myself Hugz.I am new to perl and want to write my own Scripts.But i can't understand how perl "rename" function and "file locking" works. ...
2
by: Scott Bryce | last post by:
I am creating a CGI application in Perl that uses an Access database. It will be hosted on an NT server. I have used flat file DBMs (tied hashes) on UNIX servers, but I am not familiar with how...
4
by: Stanley Cheung | last post by:
Hi all, Anyone have a "File Locking" experience? I want to ask if the application can prevent 2 user access (concurrently) to file for content editing... any lock and unlock mechanism...
4
by: darrel | last post by:
I've been dealing with a file locking issue for a while. Our CMS spits out a new XML file each time an item in the DB is updated. This XML file is basically our site menu, and is what we use on...
2
by: Dr. Who | last post by:
I'm always disappointed when I find something that Python doesn't handle in a platform independent way. It seems to me that file locking is in that boat. 1. I don't see a way to atomically open...
15
by: Matt Brandt | last post by:
I am trying to get multiple threads to lock specific regions of a file. However, since each thread has the same PID, it appears that a lock by one thread does not block another thread from the same...
1
by: =?Utf-8?B?REZTIEhFTFAgV0FOVEVE?= | last post by:
We are currently testing the Microsoft technology of Distributed File System Replication with DFS Namespaces which is working perfectly, however from the Microsoft documentation surrounding these...
2
by: Sparky | last post by:
Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.