This works in the tcl interpreter environment:
proc ec_gets_tab_delimited_line {fileId varName} {
set delimiter "\t"
if {[eof $fileId]} {
set return_val -1
} else {
gets $fileId line
set varName [split $line $delimiter]
set return_val [llength $varName]
}
return $return_val
Now to figure out how to format it for ad_proc so that the delimiter defaults to "\t" but can be changed.
ad_proc ec_gets_char_delimited_line {
fileId
varName
{delimiter "\t"}
} {
Reads and parses a line of data from a character delimited file
similar to ns_getscsv. Defaults to delimit tabs
} {
if {[eof $fileId]} {
set return_val -1
} else {
gets $fileId line
set varName [split $line $delimiter]
set return_val [llength $varName]
}
return $return_val
}
Does this appear in "good" form?