Return Code in Exit Command

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
denavit
Posts: 15
Joined: Mon Nov 13, 2006 1:33 pm
Location: University of Tennessee, Knoxville

Return Code in Exit Command

Post by denavit »

The current implementation of the "exit" command in OpenSees depreciates the standard Tcl "exit" command (http://www.tcl.tk/man/tcl/TclCmd/exit.htm) in that it does not allow the option for a return code.

The following code in OpenSeesExit within command.cpp should do the trick:

At the beginning:
int returnCode = 0;
if (argc > 1) {
if (Tcl_GetInt(interp, argv[1], &returnCode) != TCL_OK) {
opserr << "WARNING OpenSeesExit -- could not read returnCode \n";
return TCL_ERROR;
}
}

At the end:
Tcl_Exit(returnCode);

Thanks,
Mark
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Return Code in Exit Command

Post by fmk »

good idea .. i have added the change to the repository
gasui602
Posts: 3
Joined: Wed Aug 24, 2011 6:19 pm

新建 文本文档 (19)

Post by gasui602 »

This is exactly what I have been looking for!thanks for sharing
Post Reply