[Haskell-beginners] Reading a list of null-terminated filenames from stdin?

Karl Voelker karl at karlv.net
Sat Oct 10 19:14:52 UTC 2015

> On Oct 10, 2015, at 11:45 AM, Dan Stromberg <strombrg at gmail.com> wrote:
> If I want to read a list of filenames, each terminated with a nul byte, from stdin (kind of like xargs -0), what's the best way to do that in Haskell?  Or am I swimming against the current to do anything but newline-termination?

It looks like all the stdin-specific functions are line-oriented, but you can use "Data.ByteString.hGet stdin”.


> Google's top hit is:
> https://downloads.haskell.org/~ghc/7.6.1/docs/html/libraries/bytestring-
> ...but I don't see anything about nul termination there.  I checked the top ~5 hits, and didn't find much.

I don’t think it matters in this case, but you should be aware that Google does not always find the most recent results when it comes to Hackage packages. (See my link above.)


More information about the Beginners mailing list