Device names and/or numbers

Started by dukester, September 19, 2009, 04:41:27 AM

Previous topic - Next topic

dukester

Is there a list of device numbers somewhere? I've searched the manual with no luck. Something like:



Device Name    Device#

keyboard              0

crt                        1

etc

etc



As well, are:



STDIN

STDOUT

STDERR



defined?



Can I use STDIN in code to mean device#0? etc...
duke

cormullion

#1
If you create new file handles, numbering seems to start at 3. So that leaves 1 and 2 unaccounted for, as 0 is stdin/stdout. Dunno what 1 and 2 might do.



Perhaps you don't need to specify stdin/stdout, as they're the default until you choose another IO device.



Or you could do stuff like this:


(constant 'stdin 0 'stdout 0)
(device stdout)
(read-line stdin)


but it looks unnecessary to me.

TedWalther

#2
Quote from: "cormullion"If you create new file handles, numbering seems to start at 3. So that leaves 1 and 2 unaccounted for, as 0 is stdin/stdout. Dunno what 1 and 2 might do.



Perhaps you don't need to specify stdin/stdout, as they're the default until you choose another IO device.



Or you could do stuff like this:


(constant 'stdin 0 'stdout 0)
(device stdout)
(read-line stdin)


but it looks unnecessary to me.


1 is stdout. 2 is stderr. 0 is stdin.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

cormullion

#3
Makes sense!

dukester

#4
Quote from: "TedWalther"
Quote from: "cormullion"If you create new file handles, numbering seems to start at 3. So that leaves 1 and 2 unaccounted for, as 0 is stdin/stdout. Dunno what 1 and 2 might do.



Perhaps you don't need to specify stdin/stdout, as they're the default until you choose another IO device.



Or you could do stuff like this:


(constant 'stdin 0 'stdout 0)
(device stdout)
(read-line stdin)


but it looks unnecessary to me.


1 is stdout. 2 is stderr. 0 is stdin.


Is this documented anywhere that I should have stumbled upon? Anyway, thanks for the heads-up!
duke

TedWalther

#5
Quote from: "dukester"
Quote from: "TedWalther"
Quote from: "cormullion"If you create new file handles, numbering seems to start at 3. So that leaves 1 and 2 unaccounted for, as 0 is stdin/stdout. Dunno what 1 and 2 might do.



Perhaps you don't need to specify stdin/stdout, as they're the default until you choose another IO device.



Or you could do stuff like this:


(constant 'stdin 0 'stdout 0)
(device stdout)
(read-line stdin)


but it looks unnecessary to me.


1 is stdout. 2 is stderr. 0 is stdin.


Is this documented anywhere that I should have stumbled upon? Anyway, thanks for the heads-up!


It is a standard C/Unix thing.  You would come across it in the beginning of any discussion of file handles and file io.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.