Jonas Maebe ha scritto:

FPC 2.6 added support for file locking on Unix platforms. You probably should use 

  USBOut := FileOpen(UsbDev,fmOpenWrite or fmShareDenyNone);

Otherwise FileOpen will try to get an exclusive (write) lock on that device, which may well not be possible.

Understood, thank you. But shouldn't it be the other way around, i.e. one should explicitly request an exclusive lock?
Moreover I don't understand why the call returns a -1, meaning that the Open failed, without rising an exception.

Does FileOpen raise an exception in Delphi when locking fails?


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?

-- 
Giuliano Colla

Whenever people agree with me, I always feel I must be wrong (O. Wilde)


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to