7.16.1 Introduction

Prev Up Next Page 272 of 800 Search internet

The lgcio interface provides the input/output facilities needed by the lgc compiler. The facilities may also be useful for other programs.

The lgc interface is no general purpose interface, but may still be useful for programs which merely need to access files and have no need for error recovery. When the lgcio interface encounters a Unix error, it just prints an error message and calls exit(). For more advanced features, the user must define a more advanced interface, e.g. using the lgcio interface for inspiration.

The lgcio interface is defined on the base page. The facilities provided by the lgcio interface are:

Write given contents to given file. If the file does not exist, create it with mode 0666 (read/write access to everybody). For a value of umask such as 0022 this results in mode 0644 (read/write to user, read to everybody).
Same as above, but using mode 0777 instead of mode 0666. Hence, created files become executable.
Same as FileWrite, but changes newline sequences to a given sequence.
Same as FileWriteExec, but changes newline sequences to a given sequence.
Return the type of a given file (regular, directory, symbolic link, non-existent, or other).
Read the contents of a given file.
Combination of FileRead and FileType: Return t :: c where t is the type of the given file (non-existent or regular) and c is the contents of the file (if any).
Remove a given file or symlink. If the file or symlink does not exist, do nothing.
Create symbolic link.
Read symbolic link. In contrast, a FileRead on a symbolic link reads the contents of the file pointed to by the symbolic link.
Create directories containing given path. Examples: Given path abc/def/ghi create abc/ and abc/def/. Given path abc/def/ghi/ create abc/, abc/def/, and abc/def/ghi/.
Remove given, empty directory. If the directory does not exist, do nothing.
Read the entries of a given directory.
Return current working directory.
Read the clock.
Turn the running process into a demon (i.e.\ get rid of the controlling terminal). Redirect stdout and stderr. Optionally try to change user id. Optionally write the process id of the process after demonization to a file. This feature is not used by the lgc compiler but is intended for implementation of Logiweb servers.
In a given directory, run a given command with one, given argument. The search path is used to locate the command.
Send given bytes to given port of given domain and receive the response. Receiving is done with a given timeout.

Prev Up Next Page 272 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05