简体   繁体   中英

Can we lock file or folder in ubuntu by using open CV and C

I want to create a project to lock file and folders in ubuntu by face detection through opencv using C language. Can you please let me know it is possible and how can i do it.

Can't help you with the opencv part, but "lock file and folders" could mean a few things:

  • You want to change permissions of files so that a given user/group can/cannot access them. If this is the case, you want the chmod function. See man 2 chmod . Seems like this is probably what you're after?

  • Usually, "file locking" on Linux refers to a means to prevent other processes from accessing a file without changing permissions via either:

    • Mandatory file locking via lockf (or fcntl ).
    • Advisory file locking via flock .

If file locking is what you're after, here are the "see also" documents referred to by the man pages on lockf and/or flock :

https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt https://www.kernel.org/doc/Documentation/filesystems/locks.txt

Note: Others have indicated you might want to use the C++ API for opencv . All of these functions should work just fine from C++ too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM