sidney@borland.com (Sidney Markowitz) (04/30/91)
ebergman@isis.UUCP (Eric Bergman-Terrell) writes: >What problem did you have calling OpenFile from BC++ 2.0? Care to post a >code fragment? Did you call it in? What did they say? [...] >BTW I just checked my Windows application - I'm using OpenFile to make >sure a file exists (but not to actually open it). Seems to work OK In BC++, the handle that is returned by OpenFile() or _lopen() can be passed to _lread(), _lwrite() and the other SDK file I/O functions, but not to read(), write(), and similar RTL file handle I/O functions. The handle that is returned by open() can be used by read(), write(), etc., but not by _lread(), _lwrite(), etc. The problem is that both OpenFile() and open() use some auxillary data structures in parallel with the DOS file handles, and OpenFile() is compatible with the Windows SDK and MSC RTL, while open() is backwards compatible with the TC++ RTL. Call it a bug or a compatibility issue (it's at least a bug in the documentation that mention of it was left out), but in any case the workaround is to use only SDK functions or only RTL functions for handle file I/O. The low level RTL routines _read(), _write(), etc., appear to work with both types of handles. -- sidney markowitz <sidney@borland.com>
donc@microsoft.UUCP (Don CORBITT) (05/10/91)
In article <1991Apr30.115545.5197@borland.com> sidney@borland.com (Sidney Markowitz) writes: [some stuff about OpenFile() not working with BI's read()] >In BC++, the handle that is returned by OpenFile() or _lopen() can be >passed to _lread(), _lwrite() and the other SDK file I/O functions, >but not to read(), write(), and similar RTL file handle I/O functions. true. >The handle that is returned by open() can be used by read(), write(), >etc., but not by _lread(), _lwrite(), etc. false. >The problem is that both OpenFile() and open() use some auxillary data >structures in parallel with the DOS file handles, and OpenFile() is [ BI's open() does, but not OpenFile() (I believe :-)] > the workaround is to use only SDK functions or >only RTL functions for handle file I/O. a good suggestion. >The low level RTL routines _read(), _write(), etc., appear to work >with both types of handles. > > -- sidney markowitz <sidney@borland.com> Hi Sidney. _lread translates into a direct call to DOS, and only cares that its handle be a valid DOS file handle. I'm a low kinda guy, so I just use _lopen() or _lcreat(), and then _lread(), etc for access. -- Don Corbitt, Microsoft Windows