How to add a string with specific size, to structure?

 

How to add a string with specific size, to structure?

 
Avi: How to add a string with specific size, to structure?

In MQL, strings do not have a predefined allocation size. They can grow or shrink as needed.

If you want them to have a specific size, then just assign fixed size strings to the variable.

 
#include <fxsaber\SingleTesterCache\String.mqh> // https://www.mql5.com/ru/code/27611

struct A
{
  STRING128 Str;
};

void OnStart()
{
  A a;
  string Str = "Hello World!";
  
  a.Str = Str;
  Print(a.Str[]);
};
 
Thank you