FileWriteComplexFloat

complexf tipli bir parametrenin değerini, dosya işaretçisinin mevcut konumundan başlayarak ikili veya CSV dosyasına yazar.

uint  FileWriteComplexFloat(
   int       file_handle,     // Dosya tanıtıcı değeri
   complexf  value            // Yazılacak değerler
   );

Parametreler

file_handle

[in] FileOpen() fonksiyonunun dönüş yaptığı dosya tanımlayıcısı.

value

[in]  complexf tipli değer.

Dönüş değeri

Başarılı olursa fonksiyon yazılan bayt sayısına dönüş yapar. Dosya işaretçisi aynı bayt sayısı kadar kaydırılır.

Not

Hata hakkında bilgi almak için GetLastError() fonksiyonunu çağırın.

İkili dosyaya 8 bayt yazılır.

Metin veya CSV dosyasına karmaşık sayının metin gösterimi yazılır.

Örnek:

//+------------------------------------------------------------------+
//|                                         TestWriteReadComplex.mq5 |
//|                                  Copyright 2026, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script programı başlatma fonksiyonu                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   complex  complex_value=1.012345+0.0001i;
   complexf complexf_value=complexf(0.00678+0.005i);
//--- CSV dosyasına yaz
   int  file_handle=FileOpen("complex.csv",FILE_CSV|FILE_WRITE|FILE_ANSI);
   uint written=FileWriteComplexDouble(file_handle,complex_value);
   Print("written ",written," bytes");
   FileWriteString(file_handle,"\t");
   written=FileWriteComplexFloat(file_handle,complexf_value);
   Print("written ",written," bytes");
   FileWriteString(file_handle,"\n");
   FileClose(file_handle);
   complex  complex_value2;
   complexf complexf_value2;
//--- CSV dosyasından oku
   file_handle=FileOpen("complex.csv",FILE_CSV|FILE_READ|FILE_ANSI);
   complex_value2=FileReadComplexDouble(file_handle);
   complexf_value2=FileReadComplexFloat(file_handle);
   FileClose(file_handle);
   Print("complex_value2=",complex_value2);
   Print("complexf_value2=",complexf_value2);
//--- ikili dosyaya yaz
   file_handle=FileOpen("complex.bin",FILE_BIN|FILE_WRITE);
   written=FileWriteComplexDouble(file_handle,complex_value);
   Print("\nwritten ",written," bytes");
   written=FileWriteComplexFloat(file_handle,complexf_value);
   Print("written ",written," bytes");
   FileClose(file_handle);
   complex  complex_value3;
   complexf complexf_value3;
//--- ikili dosyadan oku
   file_handle=FileOpen("complex.bin",FILE_BIN|FILE_READ);
   complex_value3=FileReadComplexDouble(file_handle);
   complexf_value3=FileReadComplexFloat(file_handle);
   FileClose(file_handle);
   Print("complex_value3=",complex_value3);
   Print("complexf_value3=",complexf_value3);
  }

Experts günlüğündeki çıktı

   written 17 bytes
   written 27 bytes
   complex_value2=(1.012345,0.0001)
   complexf_value2=(0.0067799999,0.0049999999)
   
   written 16 bytes
   written 8 bytes
   complex_value3=(1.012345,0.0001)
   complexf_value3=(0.0067799999,0.0049999999)

 

Ayrıca Bakınız

Karmaşık sayı (complex, complexf), Gerçek tipler (double, float), FileWriteFloat, FileWriteComplexDouble