allbery@ncoast.UUCP (Brandon S. Allbery) (01/15/89)
In designing an "ls" program for myself, I've been playing with the INT 21 function 4E/4F (find first/next match file). Just for laughs, I tried invoking it on the pathname \DEV\CON -- and, to my surprise, it returned with an attribute byte of 40H! In playing with it, I discovered that \DEV\CON was the *only* device that produced this behavior; other devices, and \DEV\*.*, returned AX=3 (path not found). This was done in a Turbo Pascal 3.01 program running under MS-DOS 3.21. Anyone know if I hit a fluke or if this actually happens? Does it have to do with the device being open by the program (i.e. \DEV\CON is stdin/stdout/stderr -- but then, \DEV\CON1 should be open as stdaux and \DEV\LPT1 as stdprn)? Thanks in advance, from a very curious ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@ncoast.org (soon) uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@<backbone> NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser
leonard@bucket.UUCP (Leonard Erickson) (01/23/89)
In article <13338@ncoast.UUCP> allbery@ncoast.UUCP (Brandon S. Allbery) writes:
<In designing an "ls" program for myself, I've been playing with the INT 21
<function 4E/4F (find first/next match file). Just for laughs, I tried
<invoking it on the pathname \DEV\CON -- and, to my surprise, it returned
<with an attribute byte of 40H! In playing with it, I discovered that
<\DEV\CON was the *only* device that produced this behavior; other devices,
<and \DEV\*.*, returned AX=3 (path not found).
<
<This was done in a Turbo Pascal 3.01 program running under MS-DOS 3.21.
<
<Anyone know if I hit a fluke or if this actually happens? Does it have to
<do with the device being open by the program (i.e. \DEV\CON is
<stdin/stdout/stderr -- but then, \DEV\CON1 should be open as stdaux and
<\DEV\LPT1 as stdprn)?
As far as DOS is concerned, you have the following devices, which may
be treated as files:
CON stdin/stdout
AUX alias for the first com port
PRN stdprn (usually LPT1)
LPT1 1st paralell port
LPT2 2nd parallel port
LPT3 3rd ....
COM1 1st com port
COM2 2nd com port
COM3 3rd ...
COM4 4th ...
NUL null device
All of these may have \ or \DEV\ in front of them.
--
Leonard Erickson ...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."