Documentation @LINE[CON,n] @LINES[CON] not documented (bug?)

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jan 22, 2009
10
0
#1
The only help-file example of using @LINE on redirected standard input is
(echo %@line[con,0]) < myfile.dat​
which does work.

However, the assumption is that, if myfile.dat is, forexample:
a​
b​
c​
, then
(echo 0=%@line[con,0] 1=%@line[con,1] 2=%@line[con,2]) < myfile.dat​
"should" echo
0=a 1=b 2=c​
. Instead it echos (bug??)
0=a 1=c 2=**EOF**​
. It should be documented that the way to make this example work is:
(echo 0=%@line[con,0] 1=%@line[con,0] 2=%@line[con,0]) < myfile.dat​
0=a 1=b 2=c​
. Apparently STDIN cannot be "rewound" after being accessed. This means that @LINES[CON] can never be used because it "consumes" all of STDIN.

Therefore, here's an example to process STDIN in a batch file:
set i=-1
do until "%[linecon%i]" == "**EOF**"​
set i=%@INC[%i]
set linecon%i=%@LINE[CON,0]
enddo
set linecon%i=
set linescon=%@DEC[%i]​
 
May 31, 2008
376
2
#3
Can one use @FILEREAD to read stdin? The issue is how to get stdin's file descriptor - using the 'intuitive' (for linux) 0 doesn't work.

OT, I remember having seen a 4NT [sic] plugin that provides a specialized console read function, but I can't trace that plugin anymore. Does anyone know?