op_ima_sim_attr_get_str_sized()

Abstract

Obtains the value of a string simulation attribute, using a sized buffer.

Syntax

op_ima_sim_attr_get_str_sized (attr_name, size_ptr, value_buffer)
Argument Type Description
attr_name const char * name of the attribute-of-interest
[This value must specify an attribute defined in the simulation environment, or a prompt will be issued for the attribute’s value.]
size_ptr size_t * On call, pointer to the size of value_buffer (including space for the ending '\0').
On return, the actual size of the attribute value in value_buffer.
value_buffer char * pointer to a variable to be filled with the specified attribute’s value (maximum length of value is size_ptr – 1 characters).

Return Type

Compcode

OPC_COMPCODE_SUCCESS if the attribute value was successfully obtained; OPC_COMPCODE_FAILURE otherwise.

Example

/* Obtain the value of the simulation attribute "IP             */
/* Interface Addressing Mode", if specified.                    */
if (op_ima_sim_attr_exists ("IP Interface Addressing Mode") == OPC_TRUE)
	{
	/* The simulation attribute has been specified a value. */
	op_ima_sim_attr_get_str_sized ("IP Interface Addressing Mode", 32,
		ip_iface_addr_mode_setting);
	}

Details

This function is similar to op_ima_sim_attr_get_str(), except that it has a size argument and will not overrun value_buffer when returning the attribute value. For string attribute values that are larger than value_buffer, a truncated string is returned.

Purpose

Provides a mechanism to obtain simulation attributes that have been assigned values at simulation runtime. This KP works identically to op_ima_sim_attr_get(), but applies only to simulation attributes of data type string. Refer to op_ima_sim_attr_get() for full purpose and details.

Errors

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com