This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]