Sets an AutoCAD Map option.
int
ade_prefsetval(
char* variable,
struct resbuf* value);
Returns RTNORM or an error code.
variable | Option name. |
value | Value appropriate for the given option (type varies). |
See ade_prefgetval for a list of option names and values.
The following example sets "ColorForAdd" to "red".
ade_prefsetval ("ColorForAdd", rb);
The argument rb points to a resbuf structure containing
rb->resval.rstring = "red"
You can create a new resbuf structure with ads_newrb().
The following sample creates a resbuf containing the updated option value. ade_prefsetval() is called with all required parameters, the returned result code is checked for RTNORM and displayed. Then it releases the resbuf, as required.
char* pszOptionVar = "LogFileName"; struct resbuf* pSetPrefValRb = acutBuildList(RTSTR, "ade.log", 0); int nResultCode = ade_prefsetval(pszOptionVar, pSetPrefValRb); if (RTNORM == nResultCode) { acutPrintf( "\nThe %s option variable has been successfully modified to: %s" , pszOptionVar, pSetPrefValRb->resval.rstring); } else { acutPrintf( "\nThe specified options variable has not been modified."); } acutRelRb(pSetPrefValRb);