- May
- 120
- 1
I'm writing a plugin which needs to read from standard input. The
GetLine function in the SDK seems appropriate, but I'm having some
trouble using it.
I have a callback routine, which gets called in a loop from a library
API. The callback does
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
...
GetLine(in, ...)
By tracing the function calls, it seems to me that every time the
GetLine function is called, it starts again from the beginning of
standard input. This only seems to happen when stdin is redirected
from a file, like
plugin /L MyPlugin
myplugincmd <f
It does *not* happen in the case
echo some text | (plugin /L MyPlugin & myplugincmd & plugin /U MyPlugin)
What's the issue here? And how should I use GetLine to be robust when
called with a redirected file as input?
Thanks,
Paul.
GetLine function in the SDK seems appropriate, but I'm having some
trouble using it.
I have a callback routine, which gets called in a loop from a library
API. The callback does
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
...
GetLine(in, ...)
By tracing the function calls, it seems to me that every time the
GetLine function is called, it starts again from the beginning of
standard input. This only seems to happen when stdin is redirected
from a file, like
plugin /L MyPlugin
myplugincmd <f
It does *not* happen in the case
echo some text | (plugin /L MyPlugin & myplugincmd & plugin /U MyPlugin)
What's the issue here? And how should I use GetLine to be robust when
called with a redirected file as input?
Thanks,
Paul.