At
Gets the element from the given position in the array.
string At(
int pos
) const |
Parameters
pos
[in] Position of the desired element in the array.
Return Value
Note
Example:
//--- example for CArrayString::At(int)
#include <Arrays\ArrayString.mqh>
//---
void OnStart()
{
CArrayString *array=new CArrayString;
//---
if(array==NULL)
{
printf("Object create error");
return;
}
//--- add arrays elements
//--- . . .
for(int i=0;i<array.Total();i++)
{
string result=array.At(i);
if(result=="" && GetLastError()==ERR_OUT_OF_RANGE)
{
//--- Error reading from array
printf("Get element error");
delete array;
return;
}
//--- use element
//--- . . .
}
//--- delete array
delete array;
} |