On Tue, 24 Aug 1999, Support wrote:
> I do not know how to read the entire file into a single variable other than to
> append each line to the variable. I only know how to read a line at a time
> and check for an end of. Is there a faster way?
>
> Example how I am reading a line at a time:
>
> # Get teh prefs from a file
> set fh [open [join "[pwd] clients.db" /] r]
> while { [gets $fh line] >=0} {
> }
> close $fh
Here you go. If your database is more than some number of megabytes this
might be slower, but if you need all the data at once then I'm not sure of
any better alternatives.
if {[catch {open [file join [pwd] clients.db] r} fh]} {
# ERROR! Do something!
}
set dblist [split [read $fh] \n]
close $fh
...RickM...
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).