FileReadString

您所在的位置:网站首页 filereadstring FileReadString

FileReadString

2023-07-31 19:47| 来源: 网络整理| 查看: 265

//--- display the window of input parameters when launching the script #property script_show_inputs //--- parameters for data reading input string InpFileName="Trend.bin"; // file name input string InpDirectoryName="Data"; // directory name //+------------------------------------------------------------------+ //| Script program start function                                    | //+------------------------------------------------------------------+ void OnStart()   { //--- open the file    ResetLastError();    int file_handle=FileOpen(InpDirectoryName+"//"+InpFileName,FILE_READ|FILE_BIN|FILE_ANSI);    if(file_handle!=INVALID_HANDLE)      {       PrintFormat("%s file is available for reading",InpFileName);       PrintFormat("File path: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));       //--- additional variables       int    str_size;       string str;       //--- read data from the file       while(!FileIsEnding(file_handle))         {          //--- find out how many symbols are used for writing the time          str_size=FileReadInteger(file_handle,INT_VALUE);          //--- read the string          str=FileReadString(file_handle,str_size);          //--- print the string          PrintFormat(str);         }       //--- close the file       FileClose(file_handle);       PrintFormat("Data is read, %s file is closed",InpFileName);      }    else       PrintFormat("Failed to open %s file, Error code = %d",InpFileName,GetLastError());   }



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3