Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending warnings to the stdout during runtime using the Tcl C API

29 views
Skip to first unread message

William J Giddings

unread,
Apr 1, 2017, 7:41:01 AM4/1/17
to
Hi Everyone,

I need to send warning messages to the console while running a script
that loads a C module. How can I get the line and script info much like
throwing an error?
I want to give feedback of both when the error occurs in the C module
and how it was called in the Tcl script.

Regards

Will

pal...@yahoo.com

unread,
Apr 1, 2017, 10:24:49 AM4/1/17
to
I'm not sure exactly what you are asking. If it is about retrieving the line, error stack etc. from C, Tcl_GetReturnOptions will give you a dictionary with the same information. If you are asking how to write to the appropriate channel, use Tcl_GetStdChannel to retrieve stdout or stderr and then one of the Tcl_Write* functions to write to it. It's probably not a good idea to use printf etc. directly because you will bypass any channel settings like encoding, line end translation etc.

/Ashok

William J Giddings

unread,
Apr 1, 2017, 4:34:54 PM4/1/17
to
Problem solved. Opted for an alternative way of throwing an error. This,
of course, will output any error in the script I was hoping to report.

WJG
0 new messages