Forum OpenACS Q&A: Re: proc like ns_getcsv for char delimited files?

Collapse
Posted by Tom Jackson on

You can change your proc to upvar the passed in variable. The 'varName' is the name of the var you want to have the proc set. Here is the body of the proc:

    upvar $varName SplitLine

    if {[eof $fileId]} {
        set return_val -1
        set SplitLine [list]
    } else {
        gets $fileId line
        set SplitLine [split $line $delimiter]
        set return_val [llength $varName]
    }
    return $return_val