//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- объявляем и инициализируем строку
string str="Test ZeroMemory func";
//--- выведем в журнал строку до применения к ней ZeroMemory()
PrintFormat("The line before applying ZeroMemory() to it: '%s'",str);
//--- обнулим строку и выведем в журнал результат
ZeroMemory(str);
Print("The same line after applying ZeroMemory() to it: '",str,"'");
/*
Результат:
The line before applying ZeroMemory() to it: 'Test ZeroMemory func'
The same line after applying ZeroMemory() to it: ''
*/
//--- объявляем и инициализируем переменную с типом int
int var=123;
//--- выведем в журнал строку до применения к ней ZeroMemory()
PrintFormat("\nThe integer variable before applying ZeroMemory() to it: %d",var);
//--- обнулим переменную и выведем в журнал результат
ZeroMemory(var);
PrintFormat("The same variable after applying ZeroMemory() to it: %d",var);
/*
Результат:
The integer variable before applying ZeroMemory() to it: 123
The same variable after applying ZeroMemory() to it: 0
*/
//--- объявляем и инициализируем массив с типом int
int arr[]={0,1,2,3,4,5,6,7,8,9};
//--- выведем в журнал массив до применения к нему ZeroMemory()
Print("\nThe integer array before applying ZeroMemory() to it:");
ArrayPrint(arr);
//--- обнулим массив и выведем в журнал результат
ZeroMemory(arr);
Print("The same array after applying ZeroMemory() to it:");
ArrayPrint(arr);
/*
Результат:
The integer array before applying ZeroMemory() to it:
0 1 2 3 4 5 6 7 8 9
The same array after applying ZeroMemory() to it:
0 0 0 0 0 0 0 0 0 0
*/
//--- объявляем структуру из двух полей - строкового и целочисленного
struct STest
{
string var_string;
long var_long;
};
//--- объявляем и инициализируем массив с типом структуры STest
STest arr_struct[]={ {"0",0}, {"1",1}, {"2",2}, {"3",3} };
//--- выведем в журнал массив структур до применения к нему ZeroMemory()
Print("\nThe array struct before applying ZeroMemory() to it:");
ArrayPrint(arr_struct);
//--- обнулим массив структур и выведем в журнал результат
ZeroMemory(arr_struct);
Print("The same array struct after applying ZeroMemory() to it:");
ArrayPrint(arr_struct);
/*
Результат:
The array struct before applying ZeroMemory() to it:
[var_string] [var_long]
[0] "0" 0
[1] "1" 1
[2] "2" 2
[3] "3" 3
The same array struct after applying ZeroMemory() to it:
[var_string] [var_long]
[0] null 0
[1] null 0
[2] null 0
[3] null 0
*/
}
|