ajfileio.c

Datatypes: AjPFile AjPFilebuff


Datatype: AjPFile

File object

Sections: file line read operations file binary read operations


Section: file line read operations

Functions: ajReadline ajReadlineAppend ajReadlinePos ajReadlineTrim ajReadlineTrimPos


Function ajReadline

Read a line from a file.

Synopsis

Prototype
AjBool ajReadline (
      AjPFile file,
      AjPStr* Pdest
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
AjPStr*PdestOutputBuffer to hold the current line.
AjBool RETURNajTrue on success.

Output
Pdest:(Output)Buffer to hold the current line.
Input & Output
file:(Modify)Input file.
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

Function ajReadlineAppend

Reads a record from a file and appends it to the user supplied buffer.

Synopsis

Prototype
AjBool ajReadlineAppend (
      AjPFile file,
      AjPStr* Pdest
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
AjPStr*PdestModifyBuffer to hold results.
AjBool RETURNajTrue 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

Function ajReadlinePos

Reads a line from a file.

Synopsis

Prototype
AjBool ajReadlinePos (
      AjPFile file,
      AjPStr* Pdest,
      ajlong* Ppos
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
AjPStr*PdestOutputBuffer to hold the current line.
ajlong*PposOutputFile position before the read.
AjBool RETURNajTrue on success.

Output
Pdest:(Output)Buffer to hold the current line.
Ppos:(Output)File position before the read.
Input & Output
file:(Modify)Input file.
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

Function ajReadlineTrim

Reads a line from a file and removes any trailing newline.

Synopsis

Prototype
AjBool ajReadlineTrim (
      AjPFile file,
      AjPStr* Pdest
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
AjPStr*PdestOutputBuffer to hold the current line.
AjBool RETURNajTrue on success.

Output
Pdest:(Output)Buffer to hold the current line.
Input & Output
file:(Modify)Input file.
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

Function ajReadlineTrimPos

Reads a line from a file and removes any trailing newline.

Synopsis

Prototype
AjBool ajReadlineTrimPos (
      AjPFile file,
      AjPStr* Pdest,
      ajlong* Ppos
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
AjPStr*PdestOutputBuffer to hold the current line.
ajlong*PposOutputFile position before the read.
AjBool RETURNajTrue on success.

Output
Pdest:(Output)Buffer to hold the current line.
Ppos:(Output)File position before the read.
Input & Output
file:(Modify)Input file.
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

Section: file binary read operations

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


Function ajReadbinBinary

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
size_tcountInputNumber of elements to read.
size_tsizeInputNumber of bytes per element.
void*bufferOutputBuffer for output.
size_t RETURNReturn 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
file:(Modify)Input file.
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

Function ajReadbinChar

Reads a character string from a file

Synopsis

Prototype
size_t ajReadbinChar (
      AjPFile file,
      size_t size,
      char* buffer
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
size_tsizeInputNumber of bytes to read from index file.
char*bufferOutputBuffer to read into
size_t RETURNNumber 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

Function ajReadbinCharTrim

Reads a character string from a file and trims trailing spaces

Synopsis

Prototype
size_t ajReadbinCharTrim (
      AjPFile file,
      size_t size,
      char* buffer
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
size_tsizeInputNumber of bytes to read from index file.
char*bufferOutputBuffer to read into
size_t RETURNNumber 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

Function ajReadbinInt

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*PiOutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinIntEndian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*PiOutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinIntLocal

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*PiOutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt2

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajshort*Pi2OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi2:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt2Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajshort*Pi2OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi2:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt2Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajshort*Pi2OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi2:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt4

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*Pi4OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi4:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt4Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*Pi4OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi4:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt4Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajint*Pi4OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi4:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt8

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajlong*Pi8OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi8:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt8Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajlong*Pi8OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi8:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinInt8Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajlong*Pi8OutputInteger value
size_t RETURNNumber of bytes read.

Output
Pi8:(Output)Integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*PuOutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUintEndian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*PuOutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUintLocal

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*PuOutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint2

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajushort*Pu2OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu2:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint2Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajushort*Pu2OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu2:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint2Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajushort*Pu2OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu2:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint4

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*Pu4OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu4:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint4Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*Pu4OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu4:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint4Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajuint*Pu4OutputUnsigned integer value
size_t RETURNNumber of bytes read.

Output
Pu4:(Output)Unsigned integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint8

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajulong*Pu8OutputUnsigned long integer value
size_t RETURNNumber of bytes read.

Output
Pu8:(Output)Unsigned long integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint8Endian

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajulong*Pu8OutputUnsigned long integer value
size_t RETURNNumber of bytes read.

Output
Pu8:(Output)Unsigned long integer value
Input & Output
file:(Modify)Input file.
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

Function ajReadbinUint8Local

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
ajulong*Pu8OutputUnsigned long integer value
size_t RETURNNumber of bytes read.

Output
Pu8:(Output)Unsigned long integer value
Input & Output
file:(Modify)Input file.
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

Section: file binary write operations

Functions: ajWritebinBinary ajWritebinByte ajWritebinChar ajWritebinInt2 ajWritebinInt4 ajWritebinInt8 ajWritebinNewline ajWritebinStr


Function ajWritebinBinary

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
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file.
size_tcountInputNumber of elements to write.
size_tsizeInputNumber of bytes per element.
const void*bufferInputBuffer for output.
size_t RETURNReturn 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

Function ajWritebinByte

Writes a single byte to a binary file

Synopsis

Prototype
size_t ajWritebinByte (
      AjPFile file,
      char ch
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
charchInputCharacter
size_t RETURNReturn value from fwrite

Input
ch:(Input)Character
Input & Output
file:(Modify)Output file
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

Function ajWritebinChar

Writes a text string to a binary file

Synopsis

Prototype
size_t ajWritebinChar (
      AjPFile file,
      const char* txt,
      size_t len
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
const char*txtInputText string
size_tlenInputLength (padded) to write to the file
size_t RETURNReturn value from fwrite

Input
txt:(Input)Text string
len:(Input)Length (padded) to write to the file
Input & Output
file:(Modify)Output file
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

Function ajWritebinInt2

Writes a 2 byte integer to a binary file, with the correct byte orientation

Synopsis

Prototype
size_t ajWritebinInt2 (
      AjPFile file,
      ajshort i2
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
ajshorti2InputInteger
size_t RETURNReturn value from fwrite

Input
i2:(Input)Integer
Input & Output
file:(Modify)Output file
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

Function ajWritebinInt4

Writes a 4 byte integer to a binary file, with the correct byte orientation

Synopsis

Prototype
size_t ajWritebinInt4 (
      AjPFile file,
      ajint i4
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
ajinti4InputInteger
size_t RETURNReturn value from fwrite

Input
i4:(Input)Integer
Input & Output
file:(Modify)Output file
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

Function ajWritebinInt8

Writes an 8 byte long to a binary file, with the correct byte orientation

Synopsis

Prototype
size_t ajWritebinInt8 (
      AjPFile file,
      ajlong i8
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
ajlongi8InputInteger
size_t RETURNReturn value from fwrite

Input
i8:(Input)Integer
Input & Output
file:(Modify)Output file
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

Function ajWritebinNewline

Writes newline character(s) to a file

Synopsis

Prototype
size_t ajWritebinNewline (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
size_t RETURNReturn value from fwrite

Input & Output
file:(Modify)Output file
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

Function ajWritebinStr

Writes a string to a binary file

Synopsis

Prototype
size_t ajWritebinStr (
      AjPFile file,
      const AjPStr str,
      size_t len
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
const AjPStrstrInputString
size_tlenInputLength (padded) to use in the file
size_t RETURNReturn value from fwrite

Input
str:(Input)String
len:(Input)Length (padded) to use in the file
Input & Output
file:(Modify)Output file
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

Section: file line write operations

Functions: ajWriteline ajWritelineNewline ajWritelineSpace


Function ajWriteline

Writes a string to a file, including any newline characters

Synopsis

Prototype
AjBool ajWriteline (
      AjPFile file,
      const AjPStr line
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
const AjPStrlineInputString to be written
AjBool RETURNTrue on success

Input
line:(Input)String to be written
Input & Output
file:(Modify)Output file
Returns
AjBool:True on success

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

Function ajWritelineNewline

Writes a string to a file, including any newline characters

Synopsis

Prototype
AjBool ajWritelineNewline (
      AjPFile file,
      const AjPStr line
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
const AjPStrlineInputString to be written
AjBool RETURNTrue on success

Input
line:(Input)String to be written
Input & Output
file:(Modify)Output file
Returns
AjBool:True on success

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

Function ajWritelineSpace

Writes a string to a file, with a leading space

Synopsis

Prototype
AjBool ajWritelineSpace (
      AjPFile file,
      const AjPStr line
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
const AjPStrlineInputString to be written
AjBool RETURNTrue on success

Input
line:(Input)String to be written
Input & Output
file:(Modify)Output file
Returns
AjBool:True on success

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

Datatype: AjPFilebuff

Buffered file object

Sections: buffered file line read operations


Section: buffered file line read operations

Functions: ajBuffreadLine ajBuffreadLinePos ajBuffreadLinePosStore ajBuffreadLineStore ajBuffreadLineTrim


Function ajBuffreadLine

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
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered input file.
AjPStr*PdestOutputBuffer to hold results.
AjBool RETURNajTrue 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

Function ajBuffreadLinePos

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
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered input file.
AjPStr*PdestOutputBuffer to hold results.
ajlong*PposOutputFile position before the read.
AjBool RETURNajTrue 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

Function ajBuffreadLinePosStore

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
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered input file.
AjPStr*PdestOutputBuffer to hold results.
ajlong*PposOutputFile position before the read.
AjBooldostoreInputappend if true
AjPStr*PstoreOutputstring to append to
AjBool RETURNajTrue 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

Function ajBuffreadLineStore

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
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered input file.
AjPStr*PdestOutputBuffer to hold results.
AjBooldostoreInputappend if true
AjPStr*PstoreOutputstring to append to
AjBool RETURNajTrue 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

Function 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 ajBuffreadLineTrim (
      AjPFilebuff buff,
      AjPStr* Pdest
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered input file.
AjPStr*PdestOutputBuffer to hold results.
AjBool RETURNajTrue 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