06-06-2020, 14:52 +0200
MC JAX05-24-2005, 12:24   | Catch command to source file

I have the below piece of code in my program.

This should basically check for a file called list_codes.list, if it exists, then display these to the  user screen, else display error message saying file does not exist.

This file DOES exist though but i keep getting a message saying file not found

 if { [catch "source $fFile" RDONLY] } {
                        puts "<input type=text name=reason maxlength=30>"
                        puts "<input type=hidden name=rmode value=0>"
                        puts "<td class=small valign=top>($_applbl(SCRAPFILEMISSING)<br>"
                        puts "$fFile
} else {
                        puts "<select name=reason>"
                        foreach code [array names codes] {
                                puts "<option value=\"$codes($code)\">$codes($code)</option>"
CyBex  05-24-2005, 12:34   Jabber  ICQ  AOL IM  Yahoo IM  MSN  Homepage
nie da


Member since 01/2004
260 Posts
Location: Berlin
to check that file exists and is readable dont use your catch, use:                                                                                                                               
if {[file exists $fFile] && [file readable $fFile]} { .. }

or use "open" to read it.. but source interpret the file...

mfG CyBex @ QuakeNet, UnderNet, EFNet, Freenode, euIRC, GameSurge & ShadowWorld - Files
Advanced options for this topic:

Ignore this topic (Do not list this topic in the "unread topics" search. You are currently not ignoring this topic.)
Hide this topic (Hidden topics are not displayed in the topics list. This topic is currently not hidden.)
Go to forum

Unclassified NewsBoard 1.5.3-d | © 2003-4 by Yves Goergen | Time: 156.1 msec, CPU time: 68.4 msec, 31 Database queries in 115.8 msec | 3.5 kB (13.1 kB) | Timezone: +0200