[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

fildes - create a new file descriptor

fildes: fn(fd: int): ref FD;
## returns nil if unsuccessful.

Description

The Limbo programming language and its libraries manage I/O via references to instances of an abstract data type, FD, called a file descriptor. This command creates a new file descriptor.

The fildes function uses the integer file descriptor fd to create a new Limbo file descriptor (FD), suitable for other Sys module functions. It returns nil if it cannot convert fd.

Example

include "sys.m";
	sys: Sys;
	
stderr, stdout, stdin: ref Sys->FD;	
. . .
# Define the standard file handles:
	stdin  = sys->fildes(0);
	stdout = sys->fildes(1);
	stderr = sys->fildes(2);
. . .
sys->fprint(stderr, "program: write error: %r\n");

See Also

System Module Overview
open, create - open/create a file for reading or writing


[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.