This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
How to implement File locking for fstream class object
- From: "Ajay Bansal" <Ajay_Bansal at infosys dot com>
- To: <libstdc++ at gcc dot gnu dot org>
- Cc: "Pankaj Garg" <pankaj_garg at infosys dot com>,"Gagan Puri" <gaganpuri at infosys dot com>
- Date: Mon, 3 Feb 2003 20:38:16 +0530
- Subject: How to implement File locking for fstream class object
Hi,
I am using fstream in my application. I need to implement locking on my
file. Earlier fd method of filebuf class was available which gave me
filedescriptor. That file descriptor can be used by lockf or fcntl
system calls to implement file locking. How do I achive file locking
using me fstream object now?????
Following is the code snipet used for locking the file:
fcntl(m_file.rdbuf()->fd(), F_SETFD, FD_CLOEXEC);
How can achive the above functionality(file locking) on gcc 3.2.1????
Kindly advise,
Ajay