I want to make a similar tool as grep. ie. "tail -f ***.log | mygrep"
Is thera an example of how to add support for pipes?
I want to make a similar tool as grep. ie. "tail -f ***.log | mygrep"
Is thera an example of how to add support for pipes?
Allow standard input and standard output for input and output options. You might need to add flags to trigger stdio use.
Is thera an example of how to add support for pipes?
In general you do not need to add explicit support for pipes. Rather, if you read from
stdin
and write to
stdout
, pipes just work. Most folks doing that using either:
Low-level BSD routines (
open
, close
, read
, write
)Standard library routines (
fopen
, fclose
, fread
, fwrite
)Foundation
FileHandle
objectsAll of these can be called from Swift, but the last is probably the easiest to use.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"