I'm an idiot. I forgot about the #f option to read-line ... in fact, I've even used it myself.<br><br><div class="gmail_quote">On Sun, Jun 28, 2009 at 8:19 PM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5"><br>
On 28-Jun-09, at 10:46 PM, lowly coder wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I want to read a file into a string. After I open it up, is there a way to get the length of the file? (or even before I open it up?)<br>
<br>
I see that we have read-substring and read-u8vector<br>
<br>
Currently, the best solution appears to be ... do a read-u8vector on it, get it's string length, then re-open the file and do a read-substring on it ... surely there's something more elegant. :-)<br>
</blockquote>
<br></div></div>
% gsi<br>
Gambit v4.4.4<br>
<br>
> (file-info-size (file-info "test.txt"))<br>
53<br>
> (call-with-input-file "test.txt" (lambda (p) (read-line p #f)))<br>
"the read-line procedure is\ndocumented in the manual!\n"<br>
> (help read-line)<br><font color="#888888">
<br>
Marc<br>
<br>
</font></blockquote></div><br>