ajfileio.c
Datatypes: AjPFile AjPFilebuff
File object
Sections: file line read operations file binary read operations
Functions: ajReadline ajReadlineAppend ajReadlinePos ajReadlineTrim ajReadlineTrimPos
Read a line from a file.
Synopsis
Prototype
AjBool ajReadline (
AjPFile file,
AjPStr* Pdest
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
AjPStr* | Pdest | Output | Buffer to hold the current line. |
AjBool | | RETURN | ajTrue on success. |
Output
Pdest: | (Output) | Buffer to hold the current line. |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Read a line from a file.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a record from a file and appends it to the user supplied buffer.
Synopsis
Prototype
AjBool ajReadlineAppend (
AjPFile file,
AjPStr* Pdest
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
AjPStr* | Pdest | Modify | Buffer to hold results. |
AjBool | | RETURN | ajTrue on success. |
Input & Output
file: | (Modify) | Input file. |
Pdest: | (Modify) | Buffer to hold results. |
Returns
AjBool: | ajTrue on success. |
Description
Reads a record from a file and appends it to the user supplied buffer.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a file.
Synopsis
Prototype
AjBool ajReadlinePos (
AjPFile file,
AjPStr* Pdest,
ajlong* Ppos
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
AjPStr* | Pdest | Output | Buffer to hold the current line. |
ajlong* | Ppos | Output | File position before the read. |
AjBool | | RETURN | ajTrue on success. |
Output
Pdest: | (Output) | Buffer to hold the current line. |
Ppos: | (Output) | File position before the read. |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Reads a line from a file.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a file and removes any trailing newline.
Synopsis
Prototype
AjBool ajReadlineTrim (
AjPFile file,
AjPStr* Pdest
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
AjPStr* | Pdest | Output | Buffer to hold the current line. |
AjBool | | RETURN | ajTrue on success. |
Output
Pdest: | (Output) | Buffer to hold the current line. |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Reads a line from a file and removes any trailing newline.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a file and removes any trailing newline.
Synopsis
Prototype
AjBool ajReadlineTrimPos (
AjPFile file,
AjPStr* Pdest,
ajlong* Ppos
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
AjPStr* | Pdest | Output | Buffer to hold the current line. |
ajlong* | Ppos | Output | File position before the read. |
AjBool | | RETURN | ajTrue on success. |
Output
Pdest: | (Output) | Buffer to hold the current line. |
Ppos: | (Output) | File position before the read. |
Input & Output
Returns
AjBool: | ajTrue on success. |
Description
Reads a line from a file and removes any trailing newline.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajReadbinBinary ajReadbinChar ajReadbinCharTrim ajReadbinInt ajReadbinIntEndian ajReadbinIntLocal ajReadbinInt2 ajReadbinInt2Endian ajReadbinInt2Local ajReadbinInt4 ajReadbinInt4Endian ajReadbinInt4Local ajReadbinInt8 ajReadbinInt8Endian ajReadbinInt8Local ajReadbinUint ajReadbinUintEndian ajReadbinUintLocal ajReadbinUint2 ajReadbinUint2Endian ajReadbinUint2Local ajReadbinUint4 ajReadbinUint4Endian ajReadbinUint4Local ajReadbinUint8 ajReadbinUint8Endian ajReadbinUint8Local
Binary read from an input file object using the C 'fread' function.
Synopsis
Prototype
size_t ajReadbinBinary (
AjPFile file,
size_t count,
size_t size,
void* buffer
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
size_t | count | Input | Number of elements to read. |
size_t | size | Input | Number of bytes per element. |
void* | buffer | Output | Buffer for output. |
size_t | | RETURN | Return value from 'fread' |
Input
count: | (Input) | Number of elements to read. |
size: | (Input) | Number of bytes per element. |
Output
buffer: | (Output) | Buffer for output. |
Input & Output
Returns
size_t: | Return value from 'fread' |
Description
Binary read from an input file object using the C 'fread' function.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a character string from a file
Synopsis
Prototype
size_t ajReadbinChar (
AjPFile file,
size_t size,
char* buffer
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File object. |
size_t | size | Input | Number of bytes to read from index file. |
char* | buffer | Output | Buffer to read into |
size_t | | RETURN | Number of bytes read. |
Input
size: | (Input) | Number of bytes to read from index file. |
Output
buffer: | (Output) | Buffer to read into |
Input & Output
file: | (Modify) | File object. |
Returns
size_t: | Number of bytes read. |
Description
Reads a character string from a file
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a character string from a file and trims trailing spaces
Synopsis
Prototype
size_t ajReadbinCharTrim (
AjPFile file,
size_t size,
char* buffer
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File object. |
size_t | size | Input | Number of bytes to read from index file. |
char* | buffer | Output | Buffer to read into |
size_t | | RETURN | Number of bytes read. |
Input
size: | (Input) | Number of bytes to read from index file. |
Output
buffer: | (Output) | Buffer to read into |
Input & Output
file: | (Modify) | File object. |
Returns
size_t: | Number of bytes read. |
Description
Reads a character string from a file and trims trailing spaces
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinInt (
AjPFile file,
ajint* Pi
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinIntEndian (
AjPFile file,
ajint* Pi
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinIntLocal (
AjPFile file,
ajint* Pi
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of a 2 byte integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinInt2 (
AjPFile file,
ajshort* Pi2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajshort* | Pi2 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi2: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of a 2 byte integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinInt2Endian (
AjPFile file,
ajshort* Pi2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajshort* | Pi2 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi2: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinInt2Local (
AjPFile file,
ajshort* Pi2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajshort* | Pi2 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi2: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of a 4 byte integer from an input file object using
the C 'fread' function.
Synopsis
Prototype
size_t ajReadbinInt4 (
AjPFile file,
ajint* Pi4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi4 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi4: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of a 4 byte integer from an input file object using
the C 'fread' function.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinInt4Endian (
AjPFile file,
ajint* Pi4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi4 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi4: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinInt4Local (
AjPFile file,
ajint* Pi4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajint* | Pi4 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi4: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an 8 byte integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinInt8 (
AjPFile file,
ajlong* Pi8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajlong* | Pi8 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi8: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an 8 byte integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinInt8Endian (
AjPFile file,
ajlong* Pi8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajlong* | Pi8 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi8: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinInt8Local (
AjPFile file,
ajlong* Pi8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajlong* | Pi8 | Output | Integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pi8: | (Output) | Integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function.
Synopsis
Prototype
size_t ajReadbinUint (
AjPFile file,
ajuint* Pu
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinUintEndian (
AjPFile file,
ajuint* Pu
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinUintLocal (
AjPFile file,
ajuint* Pu
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinUint2 (
AjPFile file,
ajushort* Pu2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajushort* | Pu2 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu2: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinUint2Endian (
AjPFile file,
ajushort* Pu2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajushort* | Pu2 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu2: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinUint2Local (
AjPFile file,
ajushort* Pu2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajushort* | Pu2 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu2: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinUint4 (
AjPFile file,
ajuint* Pu4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu4 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu4: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from a big-endian.
Synopsis
Prototype
size_t ajReadbinUint4Endian (
AjPFile file,
ajuint* Pu4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu4 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu4: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from a big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinUint4Local (
AjPFile file,
ajuint* Pu4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajuint* | Pu4 | Output | Unsigned integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu4: | (Output) | Unsigned integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
Synopsis
Prototype
size_t ajReadbinUint8 (
AjPFile file,
ajulong* Pu8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajulong* | Pu8 | Output | Unsigned long integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu8: | (Output) | Unsigned long integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from little-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
Synopsis
Prototype
size_t ajReadbinUint8Endian (
AjPFile file,
ajulong* Pu8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajulong* | Pu8 | Output | Unsigned long integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu8: | (Output) | Unsigned long integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. Converts from big-endian.
See Also
See other functions in this section
Availability
In release 6.4.0
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
Synopsis
Prototype
size_t ajReadbinUint8Local (
AjPFile file,
ajulong* Pu8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
ajulong* | Pu8 | Output | Unsigned long integer value |
size_t | | RETURN | Number of bytes read. |
Output
Pu8: | (Output) | Unsigned long integer value |
Input & Output
Returns
size_t: | Number of bytes read. |
Description
Binary read of an unsigned integer from an input file object using
the C 'fread' function. No conversion (assumes integer was written
on the same system).
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajWritebinBinary ajWritebinByte ajWritebinChar ajWritebinInt2 ajWritebinInt4 ajWritebinInt8 ajWritebinNewline ajWritebinStr
Binary write to an output file object using the C 'fwrite' function.
Synopsis
Prototype
size_t ajWritebinBinary (
AjPFile file,
size_t count,
size_t size,
const void* buffer
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file. |
size_t | count | Input | Number of elements to write. |
size_t | size | Input | Number of bytes per element. |
const void* | buffer | Input | Buffer for output. |
size_t | | RETURN | Return value from 'fwrite' |
Input
count: | (Input) | Number of elements to write. |
size: | (Input) | Number of bytes per element. |
buffer: | (Input) | Buffer for output. |
Input & Output
file: | (Modify) | Output file. |
Returns
size_t: | Return value from 'fwrite' |
Description
Binary write to an output file object using the C 'fwrite' function.
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a single byte to a binary file
Synopsis
Prototype
size_t ajWritebinByte (
AjPFile file,
char ch
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
char | ch | Input | Character |
size_t | | RETURN | Return value from fwrite |
Input
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes a single byte to a binary file
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a text string to a binary file
Synopsis
Prototype
size_t ajWritebinChar (
AjPFile file,
const char* txt,
size_t len
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
const char* | txt | Input | Text string |
size_t | len | Input | Length (padded) to write to the file |
size_t | | RETURN | Return value from fwrite |
Input
txt: | (Input) | Text string |
len: | (Input) | Length (padded) to write to the file |
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes a text string to a binary file
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a 2 byte integer to a binary file, with the correct byte orientation
Synopsis
Prototype
size_t ajWritebinInt2 (
AjPFile file,
ajshort i2
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
ajshort | i2 | Input | Integer |
size_t | | RETURN | Return value from fwrite |
Input
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes a 2 byte integer to a binary file, with the correct byte orientation
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a 4 byte integer to a binary file, with the correct byte orientation
Synopsis
Prototype
size_t ajWritebinInt4 (
AjPFile file,
ajint i4
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
ajint | i4 | Input | Integer |
size_t | | RETURN | Return value from fwrite |
Input
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes a 4 byte integer to a binary file, with the correct byte orientation
See Also
See other functions in this section
Availability
In release 6.4.0
Writes an 8 byte long to a binary file, with the correct byte orientation
Synopsis
Prototype
size_t ajWritebinInt8 (
AjPFile file,
ajlong i8
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
ajlong | i8 | Input | Integer |
size_t | | RETURN | Return value from fwrite |
Input
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes an 8 byte long to a binary file, with the correct byte orientation
See Also
See other functions in this section
Availability
In release 6.4.0
Writes newline character(s) to a file
Synopsis
Prototype
size_t ajWritebinNewline (
AjPFile file
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
size_t | | RETURN | Return value from fwrite |
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes newline character(s) to a file
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a string to a binary file
Synopsis
Prototype
size_t ajWritebinStr (
AjPFile file,
const AjPStr str,
size_t len
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
const AjPStr | str | Input | String |
size_t | len | Input | Length (padded) to use in the file |
size_t | | RETURN | Return value from fwrite |
Input
str: | (Input) | String |
len: | (Input) | Length (padded) to use in the file |
Input & Output
Returns
size_t: | Return value from fwrite |
Description
Writes a string to a binary file
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajWriteline ajWritelineNewline ajWritelineSpace
Writes a string to a file, including any newline characters
Synopsis
Prototype
AjBool ajWriteline (
AjPFile file,
const AjPStr line
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
const AjPStr | line | Input | String to be written |
AjBool | | RETURN | True on success |
Input
line: | (Input) | String to be written |
Input & Output
Returns
Description
Writes a string to a file, including any newline characters
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a string to a file, including any newline characters
Synopsis
Prototype
AjBool ajWritelineNewline (
AjPFile file,
const AjPStr line
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
const AjPStr | line | Input | String to be written |
AjBool | | RETURN | True on success |
Input
line: | (Input) | String to be written |
Input & Output
Returns
Description
Writes a string to a file, including any newline characters
See Also
See other functions in this section
Availability
In release 6.4.0
Writes a string to a file, with a leading space
Synopsis
Prototype
AjBool ajWritelineSpace (
AjPFile file,
const AjPStr line
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Output file |
const AjPStr | line | Input | String to be written |
AjBool | | RETURN | True on success |
Input
line: | (Input) | String to be written |
Input & Output
Returns
Description
Writes a string to a file, with a leading space
See Also
See other functions in this section
Availability
In release 6.4.0
Buffered file object
Sections: buffered file line read operations
Functions: ajBuffreadLine ajBuffreadLinePos ajBuffreadLinePosStore ajBuffreadLineStore ajBuffreadLineTrim
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
Synopsis
Prototype
AjBool ajBuffreadLine (
AjPFilebuff buff,
AjPStr* Pdest
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered input file. |
AjPStr* | Pdest | Output | Buffer to hold results. |
AjBool | | RETURN | ajTrue if data was read. |
Output
Pdest: | (Output) | Buffer to hold results. |
Input & Output
buff: | (Modify) | Buffered input file. |
Returns
AjBool: | ajTrue if data was read. |
Description
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
Synopsis
Prototype
AjBool ajBuffreadLinePos (
AjPFilebuff buff,
AjPStr* Pdest,
ajlong* Ppos
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered input file. |
AjPStr* | Pdest | Output | Buffer to hold results. |
ajlong* | Ppos | Output | File position before the read. |
AjBool | | RETURN | ajTrue if data was read. |
Output
Pdest: | (Output) | Buffer to hold results. |
Ppos: | (Output) | File position before the read. |
Input & Output
buff: | (Modify) | Buffered input file. |
Returns
AjBool: | ajTrue if data was read. |
Description
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a buffered file. Also appends the line to
a given string if the append flag is true. A double NULL character
is added afterwards. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
Synopsis
Prototype
AjBool ajBuffreadLinePosStore (
AjPFilebuff buff,
AjPStr* Pdest,
ajlong* Ppos,
AjBool dostore,
AjPStr* Pstore
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered input file. |
AjPStr* | Pdest | Output | Buffer to hold results. |
ajlong* | Ppos | Output | File position before the read. |
AjBool | dostore | Input | append if true |
AjPStr* | Pstore | Output | string to append to |
AjBool | | RETURN | ajTrue if data was read. |
Input
dostore: | (Input) | append if true |
Output
Pdest: | (Output) | Buffer to hold results. |
Ppos: | (Output) | File position before the read. |
Pstore: | (Output) | string to append to |
Input & Output
buff: | (Modify) | Buffered input file. |
Returns
AjBool: | ajTrue if data was read. |
Description
Reads a line from a buffered file. Also appends the line to
a given string if the append flag is true. A double NULL character
is added afterwards. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a buffered file. Also appends the line to
a given string if the append flag is true. A double NULL character
is added afterwards. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
Synopsis
Prototype
AjBool ajBuffreadLineStore (
AjPFilebuff buff,
AjPStr* Pdest,
AjBool dostore,
AjPStr* Pstore
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered input file. |
AjPStr* | Pdest | Output | Buffer to hold results. |
AjBool | dostore | Input | append if true |
AjPStr* | Pstore | Output | string to append to |
AjBool | | RETURN | ajTrue if data was read. |
Input
dostore: | (Input) | append if true |
Output
Pdest: | (Output) | Buffer to hold results. |
Pstore: | (Output) | string to append to |
Input & Output
buff: | (Modify) | Buffered input file. |
Returns
AjBool: | ajTrue if data was read. |
Description
Reads a line from a buffered file. Also appends the line to
a given string if the append flag is true. A double NULL character
is added afterwards. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
See Also
See other functions in this section
Availability
In release 6.4.0
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
Synopsis
Prototype
AjBool ajBuffreadLineTrim (
AjPFilebuff buff,
AjPStr* Pdest
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered input file. |
AjPStr* | Pdest | Output | Buffer to hold results. |
AjBool | | RETURN | ajTrue if data was read. |
Output
Pdest: | (Output) | Buffer to hold results. |
Input & Output
buff: | (Modify) | Buffered input file. |
Returns
AjBool: | ajTrue if data was read. |
Description
Reads a line from a buffered file. If the buffer has data, reads from the
buffer. If the buffer is exhausted, reads from the file. If the file is
exhausted, sets end of file and returns. If end of file was already set,
looks for another file to open.
See Also
See other functions in this section
Availability
In release 6.4.0