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

Dan Stromberg strombrg at gmail.com
Sat Oct 10 19:40:26 UTC 2015

First off, thanks for your response.

On Sat, Oct 10, 2015 at 12:14 PM, Karl Voelker <karl at karlv.net> wrote:

> > 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”.
> http://hackage.haskell.org/package/bytestring-

I'm very much a Haskell newb, but does Data.ByteString.hGet stdin read a
fixed (maximum) number of bytes, rather than a nul terminated sequence of

> 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.

I'll keep that in mind.


Dan Stromberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151010/354ea8ad/attachment.html>

More information about the Beginners mailing list