[plt-scheme] reading a whole file

From: Stephen De Gabrielle (spdegabrielle at gmail.com)
Date: Fri Nov 14 05:09:48 EST 2008

Thank you,


Cheers,

Stephen



On Thu, Nov 13, 2008 at 9:25 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Tue, 4 Nov 2008 14:20:13 +0000, "Stephen De Gabrielle" wrote:
>> Is there a function to read a whole file into memory (as a string)
>>
>>  (lambda (i) (read-string 80000 i))
>> or is there something better?
>
> As of 4.1.2.5, we've added many convenience functions to `scheme/file'
> and `scheme/port'. Also, `scheme' now re-exports `scheme/port'.
>
>
> Added to `scheme/file':
>
>   file->string
>   file->bytes
>   file->value  ; composes `call-with-input-file*' and `read'
>   file->lines
>   file->bytes-lines
>   display-lines-to-file ; complements both file->lines and file->bytes-lines
>   write-to-file
>   display-to-file
>
> Added to `scheme/port':
>
>   call-with-input-string
>   call-with-input-bytes
>   with-input-from-string
>   with-input-from-bytes
>   call-with-output-string
>   call-with-output-bytes
>   with-output-to-string
>   with-output-to-bytes
>   port->string
>   port->bytes
>   port->lines
>   port->bytes-lines
>   display-lines
>
>
> Matthew
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.