The C language LayGO API message functions, such as lgo_ErrorMessage()
return pointers to NUL
-terminated arrays of one byte characters. In Tcl, they
return Tcl strings:
LResult result = lgo_OpenProtocol(lgo_PROTOCOL_X21_BIS, line, 0); if (result < 0) { char str[256]; sprintf(str, "Failure opening Line %d: %s", line, lgo_ErrorMessage(result)); PostError(str); }
becomes in Tcl:
my $result; $result = lgo_OpenProtocol(Laygo::PROTOCOL_X21_BIS, $line, 0); if ($result < 0) { &PostError(sprintf("Failure opening Line %d: %s", $line, lgo_ErrorMessage($result)); }