I’m porting a Unix application to Windows. Im using M$ VC++ compiler.
My problem is that on Unix the file locking mechanism is done using
the fcntl() function that doesn’t exist on Windows. I know that on
Windows I can do this using CreateFile() to get the HANDLE to a file
and then this handle can be used in LockFile() for locking the file.
But, I would like to open the file using open() function, which
returns an “int” and then for using the LockFile() I need a HANDLE to
the file, so my question is: is there a function that can transform
the “int” returned by open() into a HANDLE that then can be used in
LockFile() ?
I’m porting a Unix application to Windows. Im using M$ VC++
compiler. My problem is that on Unix the file locking mechanism is
done using the fcntl() function that doesn’t exist on Windows. I
know that on Windows I can do this using CreateFile() to get the
HANDLE to a file and then this handle can be used in LockFile() for
locking the file.
I’m porting a Unix application to Windows. Im using M$ VC++ compiler.
My problem is that on Unix the file locking mechanism is done using
the fcntl() function that doesn’t exist on Windows. I know that on
Windows I can do this using CreateFile() to get the HANDLE to a file
and then this handle can be used in LockFile() for locking the file.
But, I would like to open the file using open() function, which
returns an “int” and then for using the LockFile() I need a HANDLE to
the file, so my question is: is there a function that can transform
the “int” returned by open() into a HANDLE that then can be used in
LockFile() ?
Thanks in advance,
vc
Please don’t post non-standard stuff like this to comp.lang.c++ in the
future. If it is not part of the C++ language, as defined by the ISO
standard, it is off-topic here.
Please don’t post non-standard stuff like this to comp.lang.c++ in the
future. If it is not part of the C++ language, as defined by the ISO
standard, it is off-topic here.
If it’s off-topic on comp.lang.c++, it’s
WAY off-topic on comp.lang.ruby…
Cheers,
Hal
···
----- Original Message -----
From: “Jack Klein” jackklein@spamcop.net
Newsgroups:
comp.os.ms-windows.programmer.win32,comp.lang.ruby,comp.lang.c++,microsoft.p
ublic.dotnet.languages.vc
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, February 12, 2003 7:46 PM
Subject: Re: Using open and then LockFile for a file