Spec-Zone.ru › ColdFusion

fileIsEOF

Определяет, достиг ли ColdFusion конца файла при его чтении.

fileIsEOF(file) → returns boolean

  • CF8+
  • Lucee
  • BL 1.0.0+
  • Справочник по аргументам

    file any
    Обязательный

    Объект файла.

    Примеры
    Пример кода с вызовом функции fileIsEOF

    Простой синтаксис использования

    Вызовите fileIsEOF для объекта файла и сохраните результат в переменной.

    fileObj = fileOpen(expandPath('./file.txt');
    isEndOfFile = fileIsEOF(fileObj);

    Использование fileIsEOF для перебора всех строк текстового файла

    Упрощенный пример использования fileIsEOF для определения момента, когда все строки файла прочитаны. Обработка ошибок опущена для наглядности.

    // Error handling omitted for clarity.
    
    // open a file for reading
    fileObj = fileOpen(expandPath('./file.txt'), "read");
    
    // read each line until we read the end of the file.
    // fileIsEOF(fileObj) == false until we've read in the last line.
    while (!fileIsEOF(fileObj)) {
    
    	lineContent = fileReadLine(fileObj);
    
    	// do something with content of each line
    }
    
    // end of file reached, close the file handle
    fileClose(fileObj);

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/fileiseof

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API