# FileWriteInteger The function writes the value of the int parameter to a bin-file, starting from the current position of the file pointer. ``` uint  FileWriteInteger(    int  file_handle,        // File handle    int  value,              // Value to be written    int  size=INT_VALUE      // Size in bytes    ); ``` Parameters file_handle [in]  File descriptor returned by [FileOpen()](/en/docs/files/fileopen). value [in] Integer value. size=INT_VALUE [in] Number of bytes (up to 4 inclusive), that should be written. The corresponding constants are provided: CHAR_VALUE=1, SHORT_VALUE=2 and INT_VALUE=4, so the function can write the integer value of char, uchar, short, ushort, int, or uint type. Return Value If successful the function returns the number of bytes written. The file pointer is shifted by the same number of bytes. Example: ``` //+------------------------------------------------------------------+ //|                                        Demo_FileWriteInteger.mq5 | //|                        Copyright 2013, MetaQuotes Software Corp. | //|                                              https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link      "https://www.mql5.com" #property version   "1.00" //--- show the window of input parameters when launching the script #property script_show_inputs //--- parameters for receiving data from the terminal input string             InpSymbolName="EURUSD";           // currency pair input ENUM_TIMEFRAMES    InpSymbolPeriod=PERIOD_H1;        // time frame input datetime           InpDateStart=D'2013.01.01 00:00'; // data copying start date //--- parameters for writing data to the file input string             InpFileName="Trend.bin"; // file name input string             InpDirectoryName="Data"; // directory name //+------------------------------------------------------------------+ //| Script program start function                                    | //+------------------------------------------------------------------+ void OnStart()   {    datetime date_finish=TimeCurrent();    double   close_buff[];    datetime time_buff[];    int      size; //--- reset the error value    ResetLastError(); //--- copy the close price for each bar    if(CopyClose(InpSymbolName,InpSymbolPeriod,InpDateStart,date_finish,close_buff)==-1)      {       PrintFormat("Failed to copy the values of close prices. Error code = %d",GetLastError());       return;      } //--- copy the time for each bar    if(CopyTime(InpSymbolName,InpSymbolPeriod,InpDateStart,date_finish,time_buff)==-1)      {       PrintFormat("Failed to copy time values. Error code = %d",GetLastError());       return;      } //--- receive the buffer size    size=ArraySize(close_buff); //--- open the file for writing the values (if the file is absent, it will be created automatically)    ResetLastError();    int file_handle=FileOpen(InpDirectoryName+"//"+InpFileName,FILE_READ|FILE_WRITE|FILE_BIN);    if(file_handle!=INVALID_HANDLE)      {       PrintFormat("%s file is available for writing",InpFileName);       PrintFormat("File path: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));       //---        int   up_down=0; // trend flag       int   arr_size;  // arr array size       uchar arr[];     // uchar type array       //--- write time values to the file       for(int i=0;i