FileReadComplexFloat

파일 포인터의 현재 위치에서 바이너리 또는 CSV 파일의 complexf 타입 숫자를 읽습니다.

complexf FileReadComplexFloat(
   int     file_handle     // 파일 핸들
   );

매개변수

file_handle

[in] FileOpen()에서 반환된 파일 설명자.

반환 값

complexf 타입의 값.

참고

오류 정보를 얻으려면 GetLastError()를 호출해야 합니다.

바이너리 파일에서 8바이트를 읽습니다.

CSV 파일에서 현재 위치부터 구분자까지(또는 텍스트 줄 끝까지) 문자열을 읽고, 읽은 문자열을 complexf 타입 값으로 변환합니다.

complexf 타입 파라미터를 사용하는 FileRead 함수 호출과 동일합니다:

complexf complexf_value;
FileRead(file_handle,complexf_value);

 

예:

//+------------------------------------------------------------------+
//|                                         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"
//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   complex  complex_value=1.012345+0.0001i;
   complexf complexf_value=complexf(0.00678+0.005i);
//--- CSV 파일에 쓰기
   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 파일에서 읽기
   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);
//--- 바이너리 파일에 쓰기
   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;
//--- 바이너리 파일에서 읽기
   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 저널의 출력

   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)

더 보기

복소수 (complex, complexf), FileRead, FileReadFloat, FileWriteComplexFloat