<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Jonas Maebe ha scritto:
<blockquote cite="mid93734365-5797-4A08-B45C-3619580A333F@elis.ugent.be"
type="cite"><br>
<div>
<div>FPC 2.6 added support for file locking on Unix platforms. You
probably should use </div>
<div><br>
</div>
<div><span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: monospace;"> USBOut :=
FileOpen(UsbDev,fmOpenWrite or fmShareDenyNone);</span></span><br>
</div>
<div><br>
</div>
<div>Otherwise FileOpen will try to get an exclusive (write) lock on
that device, which may well not be possible.</div>
<div><br>
</div>
</div>
</blockquote>
Understood, thank you. But shouldn't it be the other way around, i.e.
one should explicitly request an exclusive lock?<br>
<blockquote cite="mid93734365-5797-4A08-B45C-3619580A333F@elis.ugent.be"
type="cite">
<div>
<blockquote type="cite"><span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: monospace;">Moreover I
don't understand why the call returns a -1, meaning that the Open
failed, without rising an exception.<br>
</span></span></blockquote>
</div>
<br>
<div>Does FileOpen raise an exception in Delphi when locking fails?</div>
<div><br>
</div>
<div><br>
</div>
</blockquote>
I have no idea, but if it doesn't it's a Delphi bug, I'd say. What are
exceptions there for, if not for telling you that what you requested
cannot be done?<br>
<br>
<pre class="moz-signature" cols="72">--
Giuliano Colla
Whenever people agree with me, I always feel I must be wrong (O. Wilde)
</pre>
</body>
</html>