Lugaru's Epsilon
Editor 14.04

Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
      File Primitives
         . . .
         More File Primitives
         File Properties
         Low-level File Primitives
         Manipulating File Names
         . . .
      Operating System Primitives
         System Primitives
         Window System Primitives
         Calling Windows DLLs
         Running a Process
      . . .

Previous   Up    Next
File Properties  Primitives and EEL Subroutines   Directories

Epsilon User's Manual and Reference > Primitives and EEL Subroutines > File Primitives >

Low-level File Primitives

int lowopen(char *file, int mode)

The following primitives provide low-level access to files. The lowopen( ) primitive takes the name of a file and a mode code. It returns a "file handle" for use with the other primitives. The mode may be 0 for reading only, 1 for writing only, or 2 for both. If the file doesn't exist already, the primitive will return an error, unless you use mode 3. Mode 3 creates or empties the file first, and permits reading and writing.

int lowread(int handle, byte *buf, int count)
int lowwrite(int handle, byte *buf, int count)

The lowread( ) primitive tries to read the specified number of bytes, putting them in the byte array buf, and returns the number of bytes it was able to read. A value of 0 indicates the file has ended. The lowwrite( ) primitive tries to write the specified number of bytes from the byte array buf, and returns the number it was able to write. A return value different from count may indicate that the disk is full. See Byte Arrays for functions to help translate between bytes and characters.

int lowseek(int handle, int offset, int mode)
int lowclose(int handle)

The lowseek( ) primitive repositions within the file. If the mode is 0, it positions to the offsetth byte in the file, if 1 to the offsetth byte from the previous position, and if 2 to the offsetth byte from the end. The primitive returns the new offset within the file. Finally, the lowclose( ) primitive closes the file. All these routines return -1 if an error occurred and set errno with its code.

int lowaccess(char *fname, int mode)
#define LOWACC_R        4               /* file is readable. */
#define LOWACC_W        2               /* file is writable.  */
#define LOWACC_X        1               /* file is executable.  */

The lowaccess( ) primitive takes a file name and a code indicating whether the file's read access, write access or execute access should be tested, or zero if only the file's existence need be checked. It returns 0 if the file is accessible for the specified purpose (can be read, can be written, can be executed, exists), or -1 if not.

Previous   Up    Next
File Properties  Primitives and EEL Subroutines   Directories

Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.