read_char, read_double, read_float, read_long, read_short

read_char, read_double, read_float, read_long, read_short --  read the next character, double, float, long or short value in binary representation from the input file.

Syntax

read_char (file)
read_double (file)
read_float (file)
read_long (file)
read_short (file)

		

Arguments

file

A file pointer to a previously opened file. This may be either a file in the file system, or a string opened for read and write.

Returns

read_char returns the decimal representation of a string of length 1 containing a single character, or -1 indicating end of file.

read_double, read_float return a floating point value, or nan indicating end of file.

read_long, read_short return an integer value, or -1 indicating end of file.

Description

These functions read the next character, double, float, long or short value in binary representation from the input file, regardless of Lisp expression syntax. This allows a programmer to read binary files constructed by other programs.

Example

The file "myfile.dat" contains the following:

ajz

Successive calls to read_char will produce:

    Gamma> ft = open ("myreadcfile.dat","r");
    #<File:"myreadcfile.dat">
    Gamma> read_char(ft);
    97
    Gamma> read_char(ft);
    106
    Gamma> read_char(ft);
    122
    Gamma> read_char(ft);
    -1 Gamma> 
    		

See Also

read, read_line, read_until

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.