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

Karl Voelker karl at karlv.net
Sat Oct 10 19:45:36 UTC 2015


> On Oct 10, 2015, at 12:40 PM, Dan Stromberg <strombrg at gmail.com> wrote:
> 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 bytes?

Yes, you’d have to write some code to look for nuls yourself. Or, if the input is small enough that you don’t mind reading it all into memory at once, use hGetContents.

-Karl


More information about the Beginners mailing list