Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open command returns invalid fileid 1

Status
Not open for further replies.

judyj

Programmer
Oct 15, 2002
4
US
The following code works most of the time, but ocasionally returns an error. I have a C function that generates a report (ascii text) and returns the filename (absolute path). 11 out of 13 reports return fine and I am able to open them without a failure but 2 of the reports return the filename okay (debug statement), but the open fails. All of the reports call the same function to open the report with the following lines:

set filename [ <func_name> ]
set fileid [open $filename r]
puts &quot;fileid: $fileid&quot;

Example output:
Valid fileid: fileid11
Invalid fileid: 2fileid8

Is there a way to debug this and determine the problem?
 
You are not explaining how you are integrating your
tcl and C code, so I don't know whether the problem
is due to some artifact of the filepath generation
passed to the tcl interp or what...it certainly looks
like it. The debugging could start with something like
this:
if {![catch {set fd [open [my_c_hook] r]}] err_fh} {
do_theright_thing
} else {
puts &quot;Got [set err_fh], $err_fh.&quot;
send_sigusr1_to_cprogram_for_sighandler
}

Where the procedures are all undefined..
If there are more details maybe someone else
has a better idea..




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top