Reads the contents of the file at path as text and returns the content.
Use start, to and eolChar to extract a portion of the file. start begins at 0.
Pass eolChar as empty to use start and to as character counts. Otherwise it will treat eolChar as a line break character and return from start - to lines. This allows you to read "lines" when the output is from different platforms that use different eol characters.
Pass start as empty or greater than `to` to read from the end of the file - useful for getting the tail of log files for example.
- pathOrContainer : either text which contains a path to a file, or binary data from a container field, or file set into a variable.
- start : when you want to return a sub section of the file, this is the position to begin reading
- to : when you want to return a sub section of the file, this is the position to stop reading
- eolChar : if included then start and to refer to number of lines separate by this character. The eolChar can be any character, and doesn't have to be any of the traditional end of lines, like CR or LF.
File Text Read
- 1.0.0 : First release
- 4.0.0 : Allow reading text from a container file instead of a path.
- 4.0.2 : Renamed from BE_ReadTextFromFile
- 4.2.0 : added start, to and eolChar parameters.
- 5.0.0 : Fixed a bug in the way that the function works on container fields to match the external files behaviour
- 5.0.0 : Fixed a bug in the eolChar to allow multiple character eol values
- PLUGIN PATHS ARE NOT FILEMAKER PATHS. The plugin uses the same path structure as your operating system, and you cannot pass to the plugin paths that start with file:/ or filewin:/ etc. Please read this for more info :
- Note that eolChar doesn't have to be a normal end of line character such as a line feed or carriage return. You can use any character you want. This also means that once brought into FileMaker it may not have multiple lines in the sense of what a FileMaker value list has. In other words the plugin doesn't modify the text to replace your eolChar with an end of line character.
BE_FileReadText ( $path )reads the entire file
BE_FileReadText ( $path ; 1 ; 100 )reads the first 100 characters
BE_FileReadText ( $path ; 1 ; 10 ; char ( 10 ) )reads the first 10 lines of the file
BE_FileReadText ( $path ; 10 ; ; char ( 10 ) )reads from line 10 to the end of the file
BE_FileReadText ( $path ; ; 10 ; char ( 10 ) )reads the last 10 lines of the file.