Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

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

Jan
10
0
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]​
 
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?
 

Similar threads

Back
Top