ajfile.c

Datatypes: AjPDir AjPDirout AjPFile AjPFilebuff AjPOutfile AjPStr AjPlist none


Datatype: AjPDir

Directory

Sections: Directory Constructors Directory Destructors Directory element retrieval


Section: Directory Constructors

Functions: ajDirNewPath ajDirNewPathExt ajDirNewPathPreExt


Function ajDirNewPath

Creates a new directory object.

Synopsis

Prototype
AjPDir ajDirNewPath (
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
AjPDir RETURNNew directory object.

Input
path:(Input)Directory name
Returns
AjPDir:New directory object.

Description

Creates a new directory object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirNewPathExt

Creates a new directory object.

Synopsis

Prototype
AjPDir ajDirNewPathExt (
      const AjPStr path,
      const AjPStr ext
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
const AjPStrextInputFile extension
AjPDir RETURNNew directory object.

Input
path:(Input)Directory name
ext:(Input)File extension
Returns
AjPDir:New directory object.

Description

Creates a new directory object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirNewPathPreExt

Creates a new directory object.

Synopsis

Prototype
AjPDir ajDirNewPathPreExt (
      const AjPStr path,
      const AjPStr prefix,
      const AjPStr ext
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
const AjPStrprefixInputFilename prefix
const AjPStrextInputFilename extension
AjPDir RETURNNew directory object.

Input
path:(Input)Directory name
prefix:(Input)Filename prefix
ext:(Input)Filename extension
Returns
AjPDir:New directory object.

Description

Creates a new directory object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Directory Destructors

Functions: ajDirDel


Function ajDirDel

Close and free a directory object.

Synopsis

Prototype
void ajDirDel (
      AjPDir* Pdir
);

TypeNameRead/WriteDescription
AjPDir*PdirDeleteDirectory object.
void RETURN

Output
Pdir:(Delete)Directory object.
Returns
void:No return value

Description

Close and free a directory object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Directory element retrieval

Functions: ajDirGetExt ajDirGetPath ajDirGetPrefix ajDirGetPrintpath


Function ajDirGetExt

Returns the extension(s) of a directory object

Synopsis

Prototype
const AjPStr ajDirGetExt (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory name

Description

Returns the extension(s) of a directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirGetPath

Returns the full path of a directory object

Synopsis

Prototype
const AjPStr ajDirGetPath (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory name

Description

Returns the full path of a directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirGetPrefix

Returns the filename prefix(es) of a directory object

Synopsis

Prototype
const AjPStr ajDirGetPrefix (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory name

Description

Returns the filename prefix(es) of a directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirGetPrintpath

Returns the full printable path of a directory object

Synopsis

Prototype
const AjPStr ajDirGetPrintpath (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory printable name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory printable name

Description

Returns the full printable path of a directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPDirout

Output directory

Sections: Output directory Constructors Output directory Destructors Output directory element retrieval Output directory element modifiers


Section: Output directory Constructors

Functions: ajDiroutNewPath ajDiroutNewPathExt


Function ajDiroutNewPath

Creates a new directory output object.

Synopsis

Prototype
AjPDirout ajDiroutNewPath (
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
AjPDirout RETURNNew directory object.

Input
path:(Input)Directory name
Returns
AjPDirout:New directory object.

Description

Creates a new directory output object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDiroutNewPathExt

Creates a new directory output object.

Synopsis

Prototype
AjPDirout ajDiroutNewPathExt (
      const AjPStr path,
      const AjPStr ext
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
const AjPStrextInputFile extension
AjPDirout RETURNNew directory object.

Input
path:(Input)Directory name
ext:(Input)File extension
Returns
AjPDirout:New directory object.

Description

Creates a new directory output object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Output directory Destructors

Functions: ajDiroutDel


Function ajDiroutDel

Close and free a directory object.

Synopsis

Prototype
void ajDiroutDel (
      AjPDirout* Pdir
);

TypeNameRead/WriteDescription
AjPDirout*PdirDeleteDirectory object.
void RETURN

Output
Pdir:(Delete)Directory object.
Returns
void:No return value

Description

Close and free a directory object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Output directory element retrieval

Functions: ajDiroutGetExt ajDiroutGetPath ajDiroutGetPrintpath


Function ajDiroutGetExt

Returns the extension of an output directory object

Synopsis

Prototype
const AjPStr ajDiroutGetExt (
      const AjPDirout thys
);

TypeNameRead/WriteDescription
const AjPDiroutthysInputDirectory object.
const AjPStr RETURNDirectory name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory name

Description

Returns the extension of an output directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDiroutGetPath

Returns the name of an output directory object

Synopsis

Prototype
const AjPStr ajDiroutGetPath (
      const AjPDirout thys
);

TypeNameRead/WriteDescription
const AjPDiroutthysInputDirectory object.
const AjPStr RETURNDirectory name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory name

Description

Returns the name of an output directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDiroutGetPrintpath

Returns the printable name of an output directory object

Synopsis

Prototype
const AjPStr ajDiroutGetPrintpath (
      const AjPDirout thys
);

TypeNameRead/WriteDescription
const AjPDiroutthysInputDirectory object.
const AjPStr RETURNDirectory printable name

Input
thys:(Input)Directory object.
Returns
const AjPStr:Directory printable name

Description

Returns the printable name of an output directory object

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Output directory element modifiers

Functions: ajDiroutExists ajDiroutOpen


Function ajDiroutExists

Tests a directory output object is for an existing directory

Synopsis

Prototype
AjBool ajDiroutExists (
      AjPDirout thys
);

TypeNameRead/WriteDescription
AjPDiroutthysModifyDirectory name
AjBool RETURNTrue on success.

Input & Output
thys:(Modify)Directory name
Returns
AjBool:True on success.

Description

Tests a directory output object is for an existing directory

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDiroutOpen

Opens a directory output object, creating it if it does not already exist

Synopsis

Prototype
AjBool ajDiroutOpen (
      AjPDirout thys
);

TypeNameRead/WriteDescription
AjPDiroutthysModifyDirectory name
AjBool RETURNTrue on success.

Input & Output
thys:(Modify)Directory name
Returns
AjBool:True on success.

Description

Opens a directory output object, creating it if it does not already exist

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPFile

File object

Sections: File Constructors File Destructors file reopen File modifiers file casts file debug file exit


Section: File Constructors

Functions: ajFileNewFromCfile ajFileNewInBlockS ajFileNewInNameC ajFileNewInNameS ajFileNewInNamePathC ajFileNewInNamePathS ajFileNewInPipe ajFileNewListinDirPre ajFileNewListinList ajFileNewListinNameDirS ajFileNewListinPathWild ajFileNewListinPathWildExclude ajFileNewOutNameC ajFileNewOutNameS ajFileNewOutNameDirS ajFileNewOutNamePathS ajFileNewOutappendNameS


Function ajFileNewFromCfile

Creates a new file object from an open C file.

The file is for input, output, or append - depending on how the C FILE pointer was opened.

Synopsis

Prototype
AjPFile ajFileNewFromCfile (
      FILE* file
);

TypeNameRead/WriteDescription
FILE*fileModifyC file.
AjPFile RETURNNew file object.

Input & Output
file:(Modify)C file.
Returns
AjPFile:New file object.

Description

Creates a new file object from an open C file.

The file is for input, output, or append - depending on how the C FILE pointer was opened.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInBlockS

Creates a new file object to read a named file using blocked fread calls

If the filename ends with a pipe character then a pipe is opened using ajFileNewInPipe.

Synopsis

Prototype
AjPFile ajFileNewInBlockS (
      const AjPStr name,
      ajuint blocksize
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
ajuintblocksizeInputBlock size
AjPFile RETURNNew file object.

Input
name:(Input)File name.
blocksize:(Input)Block size
Returns
AjPFile:New file object.

Description

Creates a new file object to read a named file using blocked fread calls

If the filename ends with a pipe character then a pipe is opened using ajFileNewInPipe.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInNameC

Creates a new file object to read a named file.

If the filename begins with a pipe character then a pipe is opened using ajFileNewInPipe.

Synopsis

Prototype
AjPFile ajFileNewInNameC (
      const char* name
);

TypeNameRead/WriteDescription
const char*nameInputFile name.
AjPFile RETURNNew file object.

Input
name:(Input)File name.
Returns
AjPFile:New file object.

Description

Creates a new file object to read a named file.

If the filename begins with a pipe character then a pipe is opened using ajFileNewInPipe.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInNameS

Creates a new file object to read a named file.

If the filename ends with a pipe character then a pipe is opened using ajFileNewInPipe.

Synopsis

Prototype
AjPFile ajFileNewInNameS (
      const AjPStr name
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
AjPFile RETURNNew file object.

Input
name:(Input)File name.
Returns
AjPFile:New file object.

Description

Creates a new file object to read a named file.

If the filename ends with a pipe character then a pipe is opened using ajFileNewInPipe.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInNamePathC

Opens directory "dir" Looks for file "file"

Synopsis

Prototype
AjPFile ajFileNewInNamePathC (
      const char* name,
      const AjPStr path
);

TypeNameRead/WriteDescription
const char*nameInputFilename.
const AjPStrpathInputDirectory
AjPFile RETURNNew file object.

Input
name:(Input)Filename.
path:(Input)Directory
Returns
AjPFile:New file object.

Description

Opens directory "dir" Looks for file "file"

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInNamePathS

Opens directory "dir" Looks for file "file"

Synopsis

Prototype
AjPFile ajFileNewInNamePathS (
      const AjPStr name,
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrnameInputFilename.
const AjPStrpathInputDirectory
AjPFile RETURNNew file object.

Input
name:(Input)Filename.
path:(Input)Directory
Returns
AjPFile:New file object.

Description

Opens directory "dir" Looks for file "file"

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewInPipe

Creates a new file object to read the output from a command.

Synopsis

Prototype
AjPFile ajFileNewInPipe (
      const AjPStr command
);

TypeNameRead/WriteDescription
const AjPStrcommandInputCommand string. The string may end with a trailing pipe character.
AjPFile RETURNNew file object.

Input
command:(Input)Command string. The string may end with a trailing pipe character.
Returns
AjPFile:New file object.

Description

Creates a new file object to read the output from a command.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewListinDirPre

Opens directory "dir" Looks for file "file" with the extension (if any) specified for the directory

Synopsis

Prototype
AjPFile ajFileNewListinDirPre (
      const AjPDir dir,
      const AjPStr prefix
);

TypeNameRead/WriteDescription
const AjPDirdirInputDirectory
const AjPStrprefixInputWildcard Filename.
AjPFile RETURNNew file object.

Input
dir:(Input)Directory
prefix:(Input)Wildcard Filename.
Returns
AjPFile:New file object.

Description

Opens directory "dir" Looks for file "file" with the extension (if any) specified for the directory

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewListinList

Creates a new file object with a list of input file names.

Synopsis

Prototype
AjPFile ajFileNewListinList (
      AjPList list
);

TypeNameRead/WriteDescription
AjPListlistModifyList of input filenames as strings.
AjPFile RETURNNew file object.

Input & Output
list:(Modify)List of input filenames as strings.
Returns
AjPFile:New file object.

Description

Creates a new file object with a list of input file names.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewListinNameDirS

Opens directory "dir" and looks for file "filename"

Synopsis

Prototype
AjPFile ajFileNewListinNameDirS (
      const AjPStr name,
      const AjPDir dir
);

TypeNameRead/WriteDescription
const AjPStrnameInputWildcard Filename.
const AjPDirdirInputDirectory
AjPFile RETURNNew file object.

Input
name:(Input)Wildcard Filename.
dir:(Input)Directory
Returns
AjPFile:New file object.

Description

Opens directory "dir" and looks for file "filename"

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewListinPathWild

Opens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a simple file object.

Synopsis

Prototype
AjPFile ajFileNewListinPathWild (
      const AjPStr path,
      const AjPStr wildname
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory
const AjPStrwildnameInputWildcard filename.
AjPFile RETURNNew file object.

Input
path:(Input)Directory
wildname:(Input)Wildcard filename.
Returns
AjPFile:New file object.

Description

Opens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a simple file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewListinPathWildExclude

Opens directory "dir" Looks for file(s) matching "file" Skip files matching excluded files wildcard Opens them as a list of files using a simple file object.

Synopsis

Prototype
AjPFile ajFileNewListinPathWildExclude (
      const AjPStr path,
      const AjPStr wildname,
      const AjPStr exclude
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory path
const AjPStrwildnameInputWildcard filename.
const AjPStrexcludeInputWildcard excluded filename.
AjPFile RETURNNew file object.

Input
path:(Input)Directory path
wildname:(Input)Wildcard filename.
exclude:(Input)Wildcard excluded filename.
Returns
AjPFile:New file object.

Description

Opens directory "dir" Looks for file(s) matching "file" Skip files matching excluded files wildcard Opens them as a list of files using a simple file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewOutNameC

Creates a new output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

Synopsis

Prototype
AjPFile ajFileNewOutNameC (
      const char* name
);

TypeNameRead/WriteDescription
const char*nameInputFile name.
AjPFile RETURNNew file object.

Input
name:(Input)File name.
Returns
AjPFile:New file object.

Description

Creates a new output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewOutNameS

Creates a new output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

Synopsis

Prototype
AjPFile ajFileNewOutNameS (
      const AjPStr name
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
AjPFile RETURNNew file object.

Input
name:(Input)File name.
Returns
AjPFile:New file object.

Description

Creates a new output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewOutNameDirS

Creates a new output file object with a specified directory and name. Uses the default extension (if any) specified for the directory.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

If the filename already has a directory specified, the "dir" argument is ignored.

Synopsis

Prototype
AjPFile ajFileNewOutNameDirS (
      const AjPStr name,
      const AjPDirout dir
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
const AjPDiroutdirInputDirectory (optional, can be empty or NULL).
AjPFile RETURNNew file object.

Input
name:(Input)File name.
dir:(Input)Directory (optional, can be empty or NULL).
Returns
AjPFile:New file object.

Description

Creates a new output file object with a specified directory and name. Uses the default extension (if any) specified for the directory.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

If the filename already has a directory specified, the "dir" argument is ignored.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewOutNamePathS

Creates a new output file object with a specified directory and name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

If the filename already has a directory specified, the "dir" argument is ignored.

Synopsis

Prototype
AjPFile ajFileNewOutNamePathS (
      const AjPStr name,
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
const AjPStrpathInputDirectory (optional, can be empty or NULL).
AjPFile RETURNNew file object.

Input
name:(Input)File name.
path:(Input)Directory (optional, can be empty or NULL).
Returns
AjPFile:New file object.

Description

Creates a new output file object with a specified directory and name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

If the filename already has a directory specified, the "dir" argument is ignored.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileNewOutappendNameS

Creates an output file object with a specified name. The file is opened for append so it either appends to an existing file or opens a new one.

Synopsis

Prototype
AjPFile ajFileNewOutappendNameS (
      const AjPStr name
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
AjPFile RETURNNew file object.

Input
name:(Input)File name.
Returns
AjPFile:New file object.

Description

Creates an output file object with a specified name. The file is opened for append so it either appends to an existing file or opens a new one.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: File Destructors

Functions: ajFileClose


Function ajFileClose

Close and free a file object.

Synopsis

Prototype
void ajFileClose (
      AjPFile* Pfile
);

TypeNameRead/WriteDescription
AjPFile*PfileDeleteFile.
void RETURN

Output
Pfile:(Delete)File.
Returns
void:No return value

Description

Close and free a file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file reopen

Functions: ajFileReopenName ajFileReopenNext


Function ajFileReopenName

Reopens an input file with a new name

Synopsis

Prototype
AjBool ajFileReopenName (
      AjPFile file,
      const AjPStr name
);

TypeNameRead/WriteDescription
AjPFilefileModifyInput file.
const AjPStrnameInputname of file.
AjBool RETURNTrue on success

Input
name:(Input)name of file.
Input & Output
file:(Modify)Input file.
Returns
AjBool:True on success

Description

Reopens an input file with a new name

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileReopenNext

Given a file object that includes a list of input files, closes the current input file and opens the next one.

Synopsis

Prototype
AjBool ajFileReopenNext (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
AjBool RETURNajTrue on success.

Input & Output
file:(Modify)File object.
Returns
AjBool:ajTrue on success.

Description

Given a file object that includes a list of input files, closes the current input file and opens the next one.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: File modifiers

Functions: ajFileFix ajFileResetEof ajFileResetPos ajFileSeek ajFileSetUnbuffer


Function ajFileFix

Resets internal file attribute after non-AJAX operations.

Synopsis

Prototype
AjBool ajFileFix (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
AjBool RETURNTrue if end of file is reached

Input & Output
file:(Modify)File.
Returns
AjBool:True if end of file is reached

Description

Resets internal file attribute after non-AJAX operations.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileResetEof

Resets the end of file attribute after non-AJAX operations.

Synopsis

Prototype
AjBool ajFileResetEof (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
AjBool RETURNTrue if end of file is set

Input & Output
file:(Modify)File.
Returns
AjBool:True if end of file is set

Description

Resets the end of file attribute after non-AJAX operations.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileResetPos

Resets and returns the current position in an open file.

Synopsis

Prototype
ajlong ajFileResetPos (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
ajlong RETURNResult of 'ftell'

Input & Output
file:(Modify)File.
Returns
ajlong:Result of 'ftell'

Description

Resets and returns the current position in an open file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileSeek

Sets the current position in an open file.

Resets the end-of-file flag End for cases where end-of-file was reached and then we seek back somewhere in the file.

Synopsis

Prototype
ajint ajFileSeek (
      AjPFile file,
      ajlong offset,
      ajint wherefrom
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
ajlongoffsetInputOffset
ajintwherefromInputStart of offset, as defined for 'fseek'.
ajint RETURNResult of 'fseek'

Input
offset:(Input)Offset
wherefrom:(Input)Start of offset, as defined for 'fseek'.
Input & Output
file:(Modify)File.
Returns
ajint:Result of 'fseek'

Description

Sets the current position in an open file.

Resets the end-of-file flag End for cases where end-of-file was reached and then we seek back somewhere in the file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileSetUnbuffer

Turns off system buffering of an output file, for example to allow debug output to appear even in the event of a program abort.

Synopsis

Prototype
void ajFileSetUnbuffer (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
void RETURN

Input & Output
file:(Modify)File object.
Returns
void:No return value

Description

Turns off system buffering of an output file, for example to allow debug output to appear even in the event of a program abort.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file casts

Functions: ajFileGetFileptr ajFileGetNameC ajFileGetNameS ajFileGetPrintnameC ajFileGetPrintnameS ajFileIsAppend ajFileIsEof ajFileIsFile ajFileIsStderr ajFileIsStdin ajFileIsStdout


Function ajFileGetFileptr

Returns the C file pointer for an open file.

Warning: Using the C file pointer will make internals of the file object invalid. The file position can be reset with ajFileResetPos.

Synopsis

Prototype
FILE* ajFileGetFileptr (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
FILE* RETURNC file pointer for the file.

Input
file:(Input)File.
Returns
FILE*:C file pointer for the file.

Description

Returns the C file pointer for an open file.

Warning: Using the C file pointer will make internals of the file object invalid. The file position can be reset with ajFileResetPos.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileGetNameC

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

Synopsis

Prototype
const char* ajFileGetNameC (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
const char* RETURNFilename as a C character string.

Input
file:(Input)File.
Returns
const char*:Filename as a C character string.

Description

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileGetNameS

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

Synopsis

Prototype
const AjPStr ajFileGetNameS (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
const AjPStr RETURNFilename as a C character string.

Input
file:(Input)File.
Returns
const AjPStr:Filename as a C character string.

Description

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileGetPrintnameC

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

Synopsis

Prototype
const char* ajFileGetPrintnameC (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
const char* RETURNPrintable filename as a C character string.

Input
file:(Input)File.
Returns
const char*:Printable filename as a C character string.

Description

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileGetPrintnameS

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

Synopsis

Prototype
const AjPStr ajFileGetPrintnameS (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
const AjPStr RETURNPrintable filename as a C character string.

Input
file:(Input)File.
Returns
const AjPStr:Printable filename as a C character string.

Description

Returns the file name for a file object. The filename returned is a pointer to the real string internally, so the user must take care not to change it and cannot trust the value if the file object is deleted.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsAppend

Returns the App element for a file object. The App element is True if the file was opened for appending to, False otherwise.

Synopsis

Prototype
AjBool ajFileIsAppend (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
AjBool RETURNApp element, True if if file was opened for appending to, False otherwise.

Input
file:(Input)File.
Returns
AjBool:App element, True if if file was opened for appending to, False otherwise.

Description

Returns the App element for a file object. The App element is True if the file was opened for appending to, False otherwise.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsEof

Tests whether we have reached end of file already

Synopsis

Prototype
AjBool ajFileIsEof (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile
AjBool RETURNajTrue if we already set end-of-file

Input
file:(Input)File
Returns
AjBool:ajTrue if we already set end-of-file

Description

Tests whether we have reached end of file already

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsFile

Tests whether a file object is really a regular file.

Used to test for character devices, for example standard input from a terminal.

Synopsis

Prototype
AjBool ajFileIsFile (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile object.
AjBool RETURNajTrue if the file matches stderr.

Input
file:(Input)File object.
Returns
AjBool:ajTrue if the file matches stderr.

Description

Tests whether a file object is really a regular file.

Used to test for character devices, for example standard input from a terminal.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsStderr

Tests whether a file object is really stderr.

Synopsis

Prototype
AjBool ajFileIsStderr (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile object.
AjBool RETURNajTrue if the file matches stderr.

Input
file:(Input)File object.
Returns
AjBool:ajTrue if the file matches stderr.

Description

Tests whether a file object is really stderr.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsStdin

Tests whether a file object is really stdin.

Synopsis

Prototype
AjBool ajFileIsStdin (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile object.
AjBool RETURNajTrue if the file matches stdin.

Input
file:(Input)File object.
Returns
AjBool:ajTrue if the file matches stdin.

Description

Tests whether a file object is really stdin.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileIsStdout

Tests whether a file object is really stdout.

Synopsis

Prototype
AjBool ajFileIsStdout (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile object.
AjBool RETURNajTrue if the file matches stdout.

Input
file:(Input)File object.
Returns
AjBool:ajTrue if the file matches stdout.

Description

Tests whether a file object is really stdout.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file debug

Functions: ajFileTrace


Function ajFileTrace

Writes debug messages to trace the contents of a file object.

Synopsis

Prototype
void ajFileTrace (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
void RETURN

Input
file:(Input)File.
Returns
void:No return value

Description

Writes debug messages to trace the contents of a file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file exit

Functions: ajFileExit


Function ajFileExit

Prints a summary of file usage with debug calls

Synopsis

Prototype
void ajFileExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Prints a summary of file usage with debug calls

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPFilebuff

Buffered file object

Sections: Buffered File Constructors Buffered File Destructors file reopen Buffered File Modifiers Buffered File Content Modifiers Buffered File Operators file debug


Section: Buffered File Constructors

Functions: ajFilebuffNewFromCfile ajFilebuffNewFromFile ajFilebuffNewLine ajFilebuffNewListinList ajFilebuffNewNameS ajFilebuffNewNamePathC ajFilebuffNewNamePathS ajFilebuffNewNofile ajFilebuffNewPathWild ajFilebuffNewPathWildExclude


Function ajFilebuffNewFromCfile

Creates a new buffered input file from an already open C file.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewFromCfile (
      FILE* file
);

TypeNameRead/WriteDescription
FILE*fileModifyOpen C file.
AjPFilebuff RETURNNew buffered file object.

Input & Output
file:(Modify)Open C file.
Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered input file from an already open C file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewFromFile

Creates a new buffered input file object from an open file.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewFromFile (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object to be buffered.
AjPFilebuff RETURNNew buffered file object.

Input & Output
file:(Modify)File object to be buffered.
Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered input file object from an open file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewLine

Creates a new buffered input file object with no file but with one line of buffered data provided.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewLine (
      const AjPStr line
);

TypeNameRead/WriteDescription
const AjPStrlineInputOne line of buffered data.
AjPFilebuff RETURNNew buffered file object.

Input
line:(Input)One line of buffered data.
Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered input file object with no file but with one line of buffered data provided.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewListinList

Creates a new buffered file object from a list of filenames.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewListinList (
      AjPList list
);

TypeNameRead/WriteDescription
AjPListlistModifyList of filenames as strings.
AjPFilebuff RETURNNew buffered file object.

Input & Output
list:(Modify)List of filenames as strings.
Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered file object from a list of filenames.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewNameS

Creates a new buffered input file object with an opened named file.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewNameS (
      const AjPStr name
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
AjPFilebuff RETURNNew buffered file object.

Input
name:(Input)File name.
Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered input file object with an opened named file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewNamePathC

Opens directory "dir", finds and opens file "name"

Synopsis

Prototype
AjPFilebuff ajFilebuffNewNamePathC (
      const char* name,
      const AjPStr path
);

TypeNameRead/WriteDescription
const char*nameInputFilename.
const AjPStrpathInputDirectory. If empty uses current directory.
AjPFilebuff RETURNNew buffered file object.

Input
name:(Input)Filename.
path:(Input)Directory. If empty uses current directory.
Returns
AjPFilebuff:New buffered file object.

Description

Opens directory "dir", finds and opens file "name"

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewNamePathS

Opens directory "dir", finds and opens file "name"

Synopsis

Prototype
AjPFilebuff ajFilebuffNewNamePathS (
      const AjPStr name,
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrnameInputFilename.
const AjPStrpathInputDirectory. If empty uses current directory.
AjPFilebuff RETURNNew buffered file object.

Input
name:(Input)Filename.
path:(Input)Directory. If empty uses current directory.
Returns
AjPFilebuff:New buffered file object.

Description

Opens directory "dir", finds and opens file "name"

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewNofile

Creates a new buffered input file object with an undefined file to be used as a text buffer.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewNofile (
      void
);

TypeNameRead/WriteDescription
AjPFilebuff RETURNNew buffered file object.

Returns
AjPFilebuff:New buffered file object.

Description

Creates a new buffered input file object with an undefined file to be used as a text buffer.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewPathWild

Opens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a buffered file object.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewPathWild (
      const AjPStr path,
      const AjPStr wildname
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory
const AjPStrwildnameInputWildcard filename.
AjPFilebuff RETURNNew buffered file object.

Input
path:(Input)Directory
wildname:(Input)Wildcard filename.
Returns
AjPFilebuff:New buffered file object.

Description

Opens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a buffered file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffNewPathWildExclude

Opens directory "dir" Looks for file(s) matching "file" Skip files matching excluded files wildcard Opens them as a list of files using a buffered file object.

Synopsis

Prototype
AjPFilebuff ajFilebuffNewPathWildExclude (
      const AjPStr path,
      const AjPStr wildname,
      const AjPStr exclude
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory
const AjPStrwildnameInputWildcard filename.
const AjPStrexcludeInputWildcard excluded filename.
AjPFilebuff RETURNNew buffered file object.

Input
path:(Input)Directory
wildname:(Input)Wildcard filename.
exclude:(Input)Wildcard excluded filename.
Returns
AjPFilebuff:New buffered file object.

Description

Opens directory "dir" Looks for file(s) matching "file" Skip files matching excluded files wildcard Opens them as a list of files using a buffered file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Buffered File Destructors

Functions: ajFilebuffDel


Function ajFilebuffDel

Destructor for a buffered file object.

Synopsis

Prototype
void ajFilebuffDel (
      AjPFilebuff* Pbuff
);

TypeNameRead/WriteDescription
AjPFilebuff*PbuffDeleteBuffered file object.
void RETURN

Output
Pbuff:(Delete)Buffered file object.
Returns
void:No return value

Description

Destructor for a buffered file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file reopen

Functions: ajFilebuffReopenFile


Function ajFilebuffReopenFile

Sets buffered input file to use a new open file.

The AjPFile pointer is a clone, so we should simply overwrite whatever was there before, but we do need to clear the previous buffer contents.

Synopsis

Prototype
AjBool ajFilebuffReopenFile (
      AjPFilebuff* Pbuff,
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilebuff*PbuffOutputBuffered file object.
AjPFilefileModifyFile object to be buffered.
AjBool RETURNajTrue on success

Output
Pbuff:(Output)Buffered file object.
Input & Output
file:(Modify)File object to be buffered.
Returns
AjBool:ajTrue on success

Description

Sets buffered input file to use a new open file.

The AjPFile pointer is a clone, so we should simply overwrite whatever was there before, but we do need to clear the previous buffer contents.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Buffered File Modifiers

Functions: ajFilebuffClear ajFilebuffClearStore ajFilebuffFix ajFilebuffReset ajFilebuffResetPos ajFilebuffResetStore ajFilebuffSetBuffered ajFilebuffSetUnbuffered


Function ajFilebuffClear

Deletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.

Unbuffered files need special handling. The buffer can be turned off while it still contains data. If so, we have to carefully run it down. If this runs it to zero, we may want to save the last line read.

Synopsis

Prototype
void ajFilebuffClear (
      AjPFilebuff buff,
      ajint lines
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
ajintlinesInputNumber of lines to retain. -1 deletes everything.
void RETURN

Input
lines:(Input)Number of lines to retain. -1 deletes everything.
Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Deletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.

Unbuffered files need special handling. The buffer can be turned off while it still contains data. If so, we have to carefully run it down. If this runs it to zero, we may want to save the last line read.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffClearStore

Deletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.

Unbuffered files need special handling. The buffer can be turned off while it still contains data. If so, we have to carefully run it down. If this runs it to zero, we may want to save the last line read.

Synopsis

Prototype
void ajFilebuffClearStore (
      AjPFilebuff buff,
      ajint lines,
      const AjPStr lastline,
      AjBool dostore,
      AjPStr* Pstore
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
ajintlinesInputNumber of lines to retain. -1 deletes everything.
const AjPStrlastlineInputLast line of input. Used to count characters to be saved
AjBooldostoreInputappend if true
AjPStr*PstoreOutputCaller's record of the processed lines
void RETURN

Input
lines:(Input)Number of lines to retain. -1 deletes everything.
lastline:(Input)Last line of input. Used to count characters to be saved
dostore:(Input)append if true
Output
Pstore:(Output)Caller's record of the processed lines
Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Deletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.

Unbuffered files need special handling. The buffer can be turned off while it still contains data. If so, we have to carefully run it down. If this runs it to zero, we may want to save the last line read.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffFix

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line. Fixes buffer size after the buffer has been edited.

Synopsis

Prototype
void ajFilebuffFix (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line. Fixes buffer size after the buffer has been edited.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffReset

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

Synopsis

Prototype
void ajFilebuffReset (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffResetPos

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

Also resets the file position to the last known read, to undo the damage done by (for example) ajseqabi functions.

Synopsis

Prototype
void ajFilebuffResetPos (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

Also resets the file position to the last known read, to undo the damage done by (for example) ajseqabi functions.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffResetStore

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

Synopsis

Prototype
void ajFilebuffResetStore (
      AjPFilebuff buff,
      AjBool dostore,
      AjPStr* Pstore
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
AjBooldostoreInputTrue if text is stored
AjPStr*PstoreOutputStored string cleared if store is true
void RETURN

Input
dostore:(Input)True if text is stored
Output
Pstore:(Output)Stored string cleared if store is true
Input & Output
buff:(Modify)File buffer
Returns
void:No return value

Description

Resets the pointer and current record of a file buffer so the next read starts at the first buffered line.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffSetBuffered

Sets file to be buffered. If it already has buffered data, we have to first run down the buffer.

Synopsis

Prototype
AjBool ajFilebuffSetBuffered (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file object.
AjBool RETURNajTrue if the file was unbuffered before

Input & Output
buff:(Modify)Buffered file object.
Returns
AjBool:ajTrue if the file was unbuffered before

Description

Sets file to be buffered. If it already has buffered data, we have to first run down the buffer.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffSetUnbuffered

Sets file to be unbuffered. If it already has buffered data, we have to first run down the buffer.

Synopsis

Prototype
AjBool ajFilebuffSetUnbuffered (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file object.
AjBool RETURNajTrue if the file was unbuffered before

Input & Output
buff:(Modify)Buffered file object.
Returns
AjBool:ajTrue if the file was unbuffered before

Description

Sets file to be unbuffered. If it already has buffered data, we have to first run down the buffer.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Buffered File Content Modifiers

Functions: ajFilebuffHtmlNoheader ajFilebuffHtmlPre ajFilebuffHtmlStrip ajFilebuffLoadC ajFilebuffLoadS ajFilebuffLoadAll ajFilebuffLoadReadurl


Function ajFilebuffHtmlNoheader

Processes data in the file buffer, removing HTML titles and decoding possible chunked input

Synopsis

Prototype
ajuint ajFilebuffHtmlNoheader (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file with data loaded in the buffer.
ajuint RETURNHTTP error code

Input & Output
buff:(Modify)Buffered file with data loaded in the buffer.
Returns
ajuint:HTTP error code

Description

Processes data in the file buffer, removing HTML titles and decoding possible chunked input

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffHtmlPre

If we only have one pre-formatted section in HTML, that is all we keep.

Synopsis

Prototype
AjBool ajFilebuffHtmlPre (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifybuffer
AjBool RETURNajTrue=cleaned ajFalse=unchanged

Input & Output
buff:(Modify)buffer
Returns
AjBool:ajTrue=cleaned ajFalse=unchanged

Description

If we only have one pre-formatted section in HTML, that is all we keep.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffHtmlStrip

Processes data in the file buffer, removing HTML tokens between angle brackets, plus any TITLE. This seems to be enough to make HTML output readable.

Synopsis

Prototype
void ajFilebuffHtmlStrip (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file with data loaded in the buffer.
void RETURN

Input & Output
buff:(Modify)Buffered file with data loaded in the buffer.
Returns
void:No return value

Description

Processes data in the file buffer, removing HTML tokens between angle brackets, plus any TITLE. This seems to be enough to make HTML output readable.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffLoadC

Adds a line to the buffer.

Intended for cases where the file data must be pre-processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

Synopsis

Prototype
void ajFilebuffLoadC (
      AjPFilebuff buff,
      const char* line
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file.
const char*lineInputLine of input.
void RETURN

Input
line:(Input)Line of input.
Input & Output
buff:(Modify)Buffered file.
Returns
void:No return value

Description

Adds a line to the buffer.

Intended for cases where the file data must be pre-processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffLoadS

Adds a copy of a line to the buffer.

Intended for cases where the file data must be pre processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

Synopsis

Prototype
void ajFilebuffLoadS (
      AjPFilebuff buff,
      const AjPStr line
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file.
const AjPStrlineInputLine of input.
void RETURN

Input
line:(Input)Line of input.
Input & Output
buff:(Modify)Buffered file.
Returns
void:No return value

Description

Adds a copy of a line to the buffer.

Intended for cases where the file data must be pre processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffLoadAll

Reads all input lines from a file into the buffer.

Intended for cases where the file data must be pre-processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

Synopsis

Prototype
void ajFilebuffLoadAll (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file.
void RETURN

Input & Output
buff:(Modify)Buffered file.
Returns
void:No return value

Description

Reads all input lines from a file into the buffer.

Intended for cases where the file data must be pre-processed before being seen by the sequence reading routines. The first case was for stripping HTML tags after reading via HTTP.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffLoadReadurl

Reads from a URL and loads all input lines into the buffer.

Synopsis

Prototype
AjBool ajFilebuffLoadReadurl (
      AjPFilebuff buff,
      const AjPStr url
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file.
const AjPStrurlInputURL
AjBool RETURNTrue on success

Input
url:(Input)URL
Input & Output
buff:(Modify)Buffered file.
Returns
AjBool:True on success

Description

Reads from a URL and loads all input lines into the buffer.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Buffered File Operators

Functions: ajFilebuffGetFile ajFilebuffGetFileptr ajFilebuffGetFirst ajFilebuffIsBuffered ajFilebuffIsEmpty ajFilebuffIsEnded ajFilebuffIsEof


Function ajFilebuffGetFile

Returns the file object from a buffered file object.

Synopsis

Prototype
AjPFile ajFilebuffGetFile (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
AjPFile RETURNFile object.

Input
buff:(Input)Buffered file.
Returns
AjPFile:File object.

Description

Returns the file object from a buffered file object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffGetFileptr

Returns the C file pointer for an open buffered file.

Synopsis

Prototype
FILE* ajFilebuffGetFileptr (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
FILE* RETURNC file pointer for the file.

Input
buff:(Input)Buffered file.
Returns
FILE*:C file pointer for the file.

Description

Returns the C file pointer for an open buffered file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffGetFirst

Returns the first line of a file buffer

Synopsis

Prototype
const AjPStr ajFilebuffGetFirst (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputFile buffer
const AjPStr RETURNFirst line

Input
buff:(Input)File buffer
Returns
const AjPStr:First line

Description

Returns the first line of a file buffer

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffIsBuffered

Tests whether an input file is buffered.

Synopsis

Prototype
AjBool ajFilebuffIsBuffered (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file object.
AjBool RETURNajTrue if the file was unbuffered before

Input
buff:(Input)Buffered file object.
Returns
AjBool:ajTrue if the file was unbuffered before

Description

Tests whether an input file is buffered.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffIsEmpty

Tests whether a file buffer is empty, including testing for a possible next file

Synopsis

Prototype
AjBool ajFilebuffIsEmpty (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
AjBool RETURNajTrue if the buffer is empty.

Input
buff:(Input)Buffered file.
Returns
AjBool:ajTrue if the buffer is empty.

Description

Tests whether a file buffer is empty, including testing for a possible next file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffIsEnded

Tests whether the current file is exhausted. This means end of file is reached and the buffer is empty.

It is possible that further files are defined in the input list (see ajFilebuffIsEmpty)

Synopsis

Prototype
AjBool ajFilebuffIsEnded (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputFile buffer
AjBool RETURNajTrue if we already set end-of-file

Input
buff:(Input)File buffer
Returns
AjBool:ajTrue if we already set end-of-file

Description

Tests whether the current file is exhausted. This means end of file is reached and the buffer is empty.

It is possible that further files are defined in the input list (see ajFilebuffIsEmpty)

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffIsEof

Tests whether we have reached end of file already

Synopsis

Prototype
AjBool ajFilebuffIsEof (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputFile buffer
AjBool RETURNajTrue if we already set end-of-file

Input
buff:(Input)File buffer
Returns
AjBool:ajTrue if we already set end-of-file

Description

Tests whether we have reached end of file already

See Also

See other functions in this section

Availability

In release 6.4.0

Section: file debug

Functions: ajFilebuffTrace ajFilebuffTraceFull ajFilebuffTraceTitle


Function ajFilebuffTrace

Writes debug messages to indicate the contents of a buffered file.

Synopsis

Prototype
void ajFilebuffTrace (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
void RETURN

Input
buff:(Input)Buffered file.
Returns
void:No return value

Description

Writes debug messages to indicate the contents of a buffered file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffTraceFull

Writes debug messages to show the full contents of a buffered file.

Synopsis

Prototype
void ajFilebuffTraceFull (
      const AjPFilebuff buff,
      size_t nlines,
      size_t nfree
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
size_tnlinesInputMaximum number of lines to trace.
size_tnfreeInputMaximum number of free lines to trace.
void RETURN

Input
buff:(Input)Buffered file.
nlines:(Input)Maximum number of lines to trace.
nfree:(Input)Maximum number of free lines to trace.
Returns
void:No return value

Description

Writes debug messages to show the full contents of a buffered file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilebuffTraceTitle

Writes the full contents of a buffered file to the debug file

Synopsis

Prototype
void ajFilebuffTraceTitle (
      const AjPFilebuff buff,
      const char* title
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
const char*titleInputReport title
void RETURN

Input
buff:(Input)Buffered file.
title:(Input)Report title
Returns
void:No return value

Description

Writes the full contents of a buffered file to the debug file

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPOutfile

output file object

Sections: Outfile Constructors Outfile Destructors Outfile Casts


Section: Outfile Constructors

Functions: ajOutfileNewNameS


Function ajOutfileNewNameS

Creates a new formatted output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

Synopsis

Prototype
AjPOutfile ajOutfileNewNameS (
      const AjPStr name
);

TypeNameRead/WriteDescription
const AjPStrnameInputFile name.
AjPOutfile RETURNNew output file object.

Input
name:(Input)File name.
Returns
AjPOutfile:New output file object.

Description

Creates a new formatted output file object with a specified name.

'stdout' and 'stderr' are special names for standard output and standard error respectively.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Outfile Destructors

Functions: ajOutfileClose


Function ajOutfileClose

Close and free an outfile object.

Synopsis

Prototype
void ajOutfileClose (
      AjPOutfile* Pfile
);

TypeNameRead/WriteDescription
AjPOutfile*PfileDeleteOutput file.
void RETURN

Output
Pfile:(Delete)Output file.
Returns
void:No return value

Description

Close and free an outfile object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Outfile Casts

Functions: ajOutfileGetFile ajOutfileGetFileptr ajOutfileGetFormat ajOutfileGetFormatindex


Function ajOutfileGetFile

Returns the AjPFile for an AjPOutfile object

Synopsis

Prototype
AjPFile ajOutfileGetFile (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
AjPFile RETURNAjPFile object

Input
file:(Input)Outfile object
Returns
AjPFile:AjPFile object

Description

Returns the AjPFile for an AjPOutfile object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajOutfileGetFileptr

Returns the C FILE* for an AjPOutfile object

Synopsis

Prototype
FILE* ajOutfileGetFileptr (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
FILE* RETURNC file pointer

Input
file:(Input)Outfile object
Returns
FILE*:C file pointer

Description

Returns the C FILE* for an AjPOutfile object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajOutfileGetFormat

Returns the file format name for an AjPOutfile object

Synopsis

Prototype
const AjPStr ajOutfileGetFormat (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
const AjPStr RETURNFormat name

Input
file:(Input)Outfile object
Returns
const AjPStr:Format name

Description

Returns the file format name for an AjPOutfile object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajOutfileGetFormatindex

Returns the file format name for an AjPOutfile object

Synopsis

Prototype
ajuint ajOutfileGetFormatindex (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
ajuint RETURNFormat name

Input
file:(Input)Outfile object
Returns
ajuint:Format name

Description

Returns the file format name for an AjPOutfile object

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPStr

Filename functions

Sections: Filename tests filename modifiers


Section: Filename tests

Functions: ajFilenameExists ajFilenameExistsDir ajFilenameExistsExec ajFilenameExistsRead ajFilenameExistsWrite ajFilenameGetSize ajFilenameHasPath ajFilenameTestExclude ajFilenameTestExcludePath ajFilenameTestInclude ajFilenameTestIncludePath


Function ajFilenameExists

Returns true if file exists and is read or write or executable by the user as determined by AJ_FILE_R AJ_FILE_W AJ_FILE_X file modes

Synopsis

Prototype
AjBool ajFilenameExists (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

Input
filename:(Input)Filename.
Returns
AjBool:ajTrue on success

Description

Returns true if file exists and is read or write or executable by the user as determined by AJ_FILE_R AJ_FILE_W AJ_FILE_X file modes

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameExistsDir

Returns true if file exists and is a directory

Synopsis

Prototype
AjBool ajFilenameExistsDir (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

Input
filename:(Input)Filename.
Returns
AjBool:ajTrue on success

Description

Returns true if file exists and is a directory

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameExistsExec

Returns true if file exists and is executable by the user

Synopsis

Prototype
AjBool ajFilenameExistsExec (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

Input
filename:(Input)Filename.
Returns
AjBool:ajTrue on success

Description

Returns true if file exists and is executable by the user

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameExistsRead

Returns true if file exists and is readable by the user

Synopsis

Prototype
AjBool ajFilenameExistsRead (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

Input
filename:(Input)Filename.
Returns
AjBool:ajTrue on success

Description

Returns true if file exists and is readable by the user

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameExistsWrite

Returns true if file exists and is writable by the user

Synopsis

Prototype
AjBool ajFilenameExistsWrite (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

Input
filename:(Input)Filename.
Returns
AjBool:ajTrue on success

Description

Returns true if file exists and is writable by the user

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameGetSize

Returns the length of a file

Synopsis

Prototype
ajlong ajFilenameGetSize (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
ajlong RETURNlength or -1 if file doesn't exist

Input
filename:(Input)Filename.
Returns
ajlong:length or -1 if file doesn't exist

Description

Returns the length of a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameHasPath

Tests whether a filename includes a directory specification.

Synopsis

Prototype
AjBool ajFilenameHasPath (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFile name.
AjBool RETURNajTrue if directory filename syntax was found

Input
filename:(Input)File name.
Returns
AjBool:ajTrue if directory filename syntax was found

Description

Tests whether a filename includes a directory specification.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTestExclude

Tests a filename against wildcard lists of file names to be included and excluded.

The path (if any) is removed before checking.

By default files are excluded. The inclusion list is used to select files, and the exclusion list is then used to exclude selected files again.

Synopsis

Prototype
AjBool ajFilenameTestExclude (
      const AjPStr filename,
      const AjPStr exclude,
      const AjPStr include
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFile to test
const AjPStrexcludeInputList of wildcard names to exclude
const AjPStrincludeInputList of wildcard names to include
AjBool RETURNajTrue if the filename is accepted.

Input
filename:(Input)File to test
exclude:(Input)List of wildcard names to exclude
include:(Input)List of wildcard names to include
Returns
AjBool:ajTrue if the filename is accepted.

Description

Tests a filename against wildcard lists of file names to be included and excluded.

The path (if any) is removed before checking.

By default files are excluded. The inclusion list is used to select files, and the exclusion list is then used to exclude selected files again.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTestExcludePath

Tests a full path filename against wildcard lists of file names to be included and excluded.

The full path is retained and included in the tests.

By default files are excluded. The inclusion list is used to select files, and the exclusion list is then used to exclude selected files again.

Synopsis

Prototype
AjBool ajFilenameTestExcludePath (
      const AjPStr filename,
      const AjPStr exclude,
      const AjPStr include
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFile to test
const AjPStrexcludeInputList of wildcard names to exclude
const AjPStrincludeInputList of wildcard names to include
AjBool RETURNajTrue if the filename is accepted.

Input
filename:(Input)File to test
exclude:(Input)List of wildcard names to exclude
include:(Input)List of wildcard names to include
Returns
AjBool:ajTrue if the filename is accepted.

Description

Tests a full path filename against wildcard lists of file names to be included and excluded.

The full path is retained and included in the tests.

By default files are excluded. The inclusion list is used to select files, and the exclusion list is then used to exclude selected files again.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTestInclude

Tests a filename against wildcard lists of file names to be included and excluded.

By default files are included. The exclusion list is used to trim out files, and the inclusion list is then used to add selected files again.

Synopsis

Prototype
AjBool ajFilenameTestInclude (
      const AjPStr filename,
      const AjPStr exclude,
      const AjPStr include
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFile to test
const AjPStrexcludeInputList of wildcard names to exclude
const AjPStrincludeInputList of wildcard names to include
AjBool RETURNajTrue if the filename is accepted.

Input
filename:(Input)File to test
exclude:(Input)List of wildcard names to exclude
include:(Input)List of wildcard names to include
Returns
AjBool:ajTrue if the filename is accepted.

Description

Tests a filename against wildcard lists of file names to be included and excluded.

By default files are included. The exclusion list is used to trim out files, and the inclusion list is then used to add selected files again.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTestIncludePath

Tests a filename against wildcard lists of file names to be included and excluded.

By default files are included. The exclusion list is used to trim out files, and the inclusion list is then used to add selected files again.

Synopsis

Prototype
AjBool ajFilenameTestIncludePath (
      const AjPStr filename,
      const AjPStr exclude,
      const AjPStr include
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFile to test
const AjPStrexcludeInputList of wildcard names to exclude
const AjPStrincludeInputList of wildcard names to include
AjBool RETURNajTrue if the filename is accepted.

Input
filename:(Input)File to test
exclude:(Input)List of wildcard names to exclude
include:(Input)List of wildcard names to include
Returns
AjBool:ajTrue if the filename is accepted.

Description

Tests a filename against wildcard lists of file names to be included and excluded.

By default files are included. The exclusion list is used to trim out files, and the inclusion list is then used to add selected files again.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: filename modifiers

Functions: ajFilenameReplaceExtC ajFilenameReplaceExtS ajFilenameReplacePathC ajFilenameReplacePathS ajFilenameSetExtC ajFilenameSetExtS ajFilenameSetTempname ajFilenameSetTempnamePathC ajFilenameSetTempnamePathS ajFilenameTrimAll ajFilenameTrimExt ajFilenameTrimPath ajFilenameTrimPathExt


Function ajFilenameReplaceExtC

Replaces the extension part of a filename

Synopsis

Prototype
AjBool ajFilenameReplaceExtC (
      AjPStr* Pfilename,
      const char* txt
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const char*txtInputNew file extension
AjBool RETURNajTrue if the replacement succeeded.

Input
txt:(Input)New file extension
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Replaces the extension part of a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameReplaceExtS

Replaces the extension part of a filename

Synopsis

Prototype
AjBool ajFilenameReplaceExtS (
      AjPStr* Pfilename,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const AjPStrstrInputNew file extension
AjBool RETURNajTrue if the replacement succeeded.

Input
str:(Input)New file extension
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Replaces the extension part of a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameReplacePathC

Sets the directory part of a filename

Synopsis

Prototype
AjBool ajFilenameReplacePathC (
      AjPStr* Pfilename,
      const char* txt
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const char*txtInputDirectory
AjBool RETURNajTrue if the replacement succeeded.

Input
txt:(Input)Directory
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Sets the directory part of a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameReplacePathS

Sets the directory part of a filename

Synopsis

Prototype
AjBool ajFilenameReplacePathS (
      AjPStr* Pfilename,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const AjPStrstrInputNew directory
AjBool RETURNajTrue if the replacement succeeded.

Input
str:(Input)New directory
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Sets the directory part of a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameSetExtC

Sets the extension part of a filename

Synopsis

Prototype
AjBool ajFilenameSetExtC (
      AjPStr* Pfilename,
      const char* txt
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const char*txtInputNew file extension
AjBool RETURNajTrue if the replacement succeeded.

Input
txt:(Input)New file extension
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Sets the extension part of a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameSetExtS

Sets the extension part of a base filename

Synopsis

Prototype
AjBool ajFilenameSetExtS (
      AjPStr* Pfilename,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename.
const AjPStrstrInputNew file extension
AjBool RETURNajTrue if the replacement succeeded.

Input
str:(Input)New file extension
Input & Output
Pfilename:(Modify)Filename.
Returns
AjBool:ajTrue if the replacement succeeded.

Description

Sets the extension part of a base filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameSetTempname

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

Synopsis

Prototype
AjBool ajFilenameSetTempname (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameOutputFilename of new temporary file
AjBool RETURNTrue on success

Output
Pfilename:(Output)Filename of new temporary file
Returns
AjBool:True on success

Description

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameSetTempnamePathC

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

Synopsis

Prototype
AjBool ajFilenameSetTempnamePathC (
      AjPStr* Pfilename,
      const char* txt
);

TypeNameRead/WriteDescription
AjPStr*PfilenameOutputFilename of new temporary file
const char*txtInputDirectory path
AjBool RETURNTrue on success

Input
txt:(Input)Directory path
Output
Pfilename:(Output)Filename of new temporary file
Returns
AjBool:True on success

Description

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameSetTempnamePathS

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

Synopsis

Prototype
AjBool ajFilenameSetTempnamePathS (
      AjPStr* Pfilename,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPStr*PfilenameOutputFilename of new temporary file
const AjPStrstrInputDirectory path
AjBool RETURNTrue on success

Input
str:(Input)Directory path
Output
Pfilename:(Output)Filename of new temporary file
Returns
AjBool:True on success

Description

Returns an available temporary filename that can be opened for writing Filename will be of the form progname-time.randomnumber Tries 5 times to find a new filename. Returns ajFalse if not successful or the file cannot be opened for writing. This function returns only the filename, not a file pointer.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTrimAll

Truncates a filename to a basic file name.

Synopsis

Prototype
AjBool ajFilenameTrimAll (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFile name
AjBool RETURNajTrue on success, and returns a filename. ajFalse on failure, and returns an empty string.

Input & Output
Pfilename:(Modify)File name
Returns
AjBool:ajTrue on success, and returns a filename. ajFalse on failure, and returns an empty string.

Description

Truncates a filename to a basic file name.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTrimExt

Trims the extension (if any) from a filename

Synopsis

Prototype
AjBool ajFilenameTrimExt (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename
AjBool RETURNajTrue is there was an extension

Input & Output
Pfilename:(Modify)Filename
Returns
AjBool:ajTrue is there was an extension

Description

Trims the extension (if any) from a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTrimPath

Trims the directory path (if any) from a filename

Synopsis

Prototype
AjBool ajFilenameTrimPath (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename
AjBool RETURNajTrue is there was a directory

Input & Output
Pfilename:(Modify)Filename
Returns
AjBool:ajTrue is there was a directory

Description

Trims the directory path (if any) from a filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilenameTrimPathExt

Trims the directory path (if any) and extension (if any) from a filename.

Synopsis

Prototype
AjBool ajFilenameTrimPathExt (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename
AjBool RETURNajTrue is there was a directory path or extension.

Input & Output
Pfilename:(Modify)Filename
Returns
AjBool:ajTrue is there was a directory path or extension.

Description

Trims the directory path (if any) and extension (if any) from a filename.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: directory name modifiers

Functions: ajDirnameFillPath ajDirnameFix ajDirnameFixExists ajDirnameUp


Function ajDirnameFillPath

Checks that a string is a valid directory, and makes sure it has the full path definition.

Synopsis

Prototype
AjBool ajDirnameFillPath (
      AjPStr* Pdirname
);

TypeNameRead/WriteDescription
AjPStr*PdirnameModifyDirectory path
AjBool RETURNtrue if a valid directory.

Input & Output
Pdirname:(Modify)Directory path
Returns
AjBool:true if a valid directory.

Description

Checks that a string is a valid directory, and makes sure it has the full path definition.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirnameFix

If the directory name has no trailing slash (on Unix) then one is added. This is why the directory name must be writable.

Synopsis

Prototype
void ajDirnameFix (
      AjPStr* Pdirname
);

TypeNameRead/WriteDescription
AjPStr*PdirnameModifyDirectory name.
void RETURN

Input & Output
Pdirname:(Modify)Directory name.
Returns
void:No return value

Description

If the directory name has no trailing slash (on Unix) then one is added. This is why the directory name must be writable.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirnameFixExists

Checks that a string is a valid existing directory, and appends a trailing '/' if it is missing.

Synopsis

Prototype
AjBool ajDirnameFixExists (
      AjPStr* Pdirname
);

TypeNameRead/WriteDescription
AjPStr*PdirnameModifyDirectory path
AjBool RETURNtrue if a valid directory.

Input & Output
Pdirname:(Modify)Directory path
Returns
AjBool:true if a valid directory.

Description

Checks that a string is a valid existing directory, and appends a trailing '/' if it is missing.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajDirnameUp

Changes directory name to one level up

Synopsis

Prototype
AjBool ajDirnameUp (
      AjPStr* Pdirname
);

TypeNameRead/WriteDescription
AjPStr*PdirnameModifyDirectory name.
AjBool RETURNajTrue on success.

Input & Output
Pdirname:(Modify)Directory name.
Returns
AjBool:ajTrue on success.

Description

Changes directory name to one level up

See Also

See other functions in this section

Availability

In release 6.4.0

Section: directory functions

Functions: ajDirnamePrintRecursiveIgnore


Function ajDirnamePrintRecursiveIgnore

Recursively scan through a directory, printing directory and file names

Synopsis

Prototype
void ajDirnamePrintRecursiveIgnore (
      const AjPStr path,
      AjPList ignorelist,
      AjPFile outfile
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory to scan
AjPListignorelistModifyList of directories to ignore
AjPFileoutfileModifyFile for "show" results (or NULL)
void RETURN

Input
path:(Input)Directory to scan
Input & Output
ignorelist:(Modify)List of directories to ignore
outfile:(Modify)File for "show" results (or NULL)
Returns
void:No return value

Description

Recursively scan through a directory, printing directory and file names

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPlist

Lists of filenames

Sections: File list addition


Section: File list addition

Functions: ajFilelistAddDirectory ajFilelistAddListname ajFilelistAddPath ajFilelistAddPathDir ajFilelistAddPathWild ajFilelistAddPathWildDir ajFilelistAddPathWildRecursiveIgnore


Function ajFilelistAddDirectory

Scan through a directory object returning all filenames that are not directories. Uses the file extension and any other attributes of the directory object. An empty string as a file extension accepts only files that have no extension.

Synopsis

Prototype
ajint ajFilelistAddDirectory (
      AjPList list,
      const AjPDir dir
);

TypeNameRead/WriteDescription
AjPListlistModifyList for matching entries
const AjPDirdirInputDirectory to scan
ajint RETURNnumber of entries in list

Input
dir:(Input)Directory to scan
Input & Output
list:(Modify)List for matching entries
Returns
ajint:number of entries in list

Description

Scan through a directory object returning all filenames that are not directories. Uses the file extension and any other attributes of the directory object. An empty string as a file extension accepts only files that have no extension.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddListname

Adds to a list of files that match a comma-separated string of filenames which can include wildcards or listfiles

Synopsis

Prototype
ajint ajFilelistAddListname (
      AjPList list,
      const AjPStr listname
);

TypeNameRead/WriteDescription
AjPListlistModifyList of filenames
const AjPStrlistnameInputcomma-separated filename list
ajint RETURNNumber of entries added to list

Input
listname:(Input)comma-separated filename list
Input & Output
list:(Modify)List of filenames
Returns
ajint:Number of entries added to list

Description

Adds to a list of files that match a comma-separated string of filenames which can include wildcards or listfiles

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddPath

Scan through a directory returning all filenames excluding directory names

Synopsis

Prototype
ajint ajFilelistAddPath (
      AjPList list,
      const AjPStr path
);

TypeNameRead/WriteDescription
AjPListlistModifyList for matching entries
const AjPStrpathInputDirectory to scan
ajint RETURNnumber of entries in list

Input
path:(Input)Directory to scan
Input & Output
list:(Modify)List for matching entries
Returns
ajint:number of entries in list

Description

Scan through a directory returning all filenames excluding directory names

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddPathDir

Scan through a directory returning all filenames and directory names except '.' and '..', including directories

Synopsis

Prototype
ajint ajFilelistAddPathDir (
      AjPList list,
      const AjPStr path
);

TypeNameRead/WriteDescription
AjPListlistModifyList for matching entries
const AjPStrpathInputDirectory to scan
ajint RETURNnumber of entries in list

Input
path:(Input)Directory to scan
Input & Output
list:(Modify)List for matching entries
Returns
ajint:number of entries in list

Description

Scan through a directory returning all filenames and directory names except '.' and '..', including directories

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddPathWild

Scan through a directory returning all filenames matching a wildcard filename

Synopsis

Prototype
ajint ajFilelistAddPathWild (
      AjPList list,
      const AjPStr path,
      const AjPStr wildname
);

TypeNameRead/WriteDescription
AjPListlistOutputList for matching entries
const AjPStrpathInputDirectory to scan
const AjPStrwildnameInputFilename to search for
ajint RETURNnumber of entries in list

Input
path:(Input)Directory to scan
wildname:(Input)Filename to search for
Output
list:(Output)List for matching entries
Returns
ajint:number of entries in list

Description

Scan through a directory returning all filenames matching a wildcard filename

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddPathWildDir

Scan through a directory returning all filenames matching a wildcard filename, including directories

Synopsis

Prototype
ajint ajFilelistAddPathWildDir (
      AjPList list,
      const AjPStr path,
      const AjPStr wildname
);

TypeNameRead/WriteDescription
AjPListlistOutputList for matching entries
const AjPStrpathInputDirectory to scan
const AjPStrwildnameInputFilename to search for
ajint RETURNnumber of entries in list

Input
path:(Input)Directory to scan
wildname:(Input)Filename to search for
Output
list:(Output)List for matching entries
Returns
ajint:number of entries in list

Description

Scan through a directory returning all filenames matching a wildcard filename, including directories

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFilelistAddPathWildRecursiveIgnore

Recursively scan through a directory

Synopsis

Prototype
ajint ajFilelistAddPathWildRecursiveIgnore (
      AjPList list,
      const AjPStr path,
      const AjPStr wildname,
      AjPList ignorelist
);

TypeNameRead/WriteDescription
AjPListlistModifyList for matching filenames
const AjPStrpathInputDirectory to scan
const AjPStrwildnameInputFilename to search for (or NULL)
AjPListignorelistModifyList of directories to ignore
ajint RETURNnumber of new entries in list

Input
path:(Input)Directory to scan
wildname:(Input)Filename to search for (or NULL)
Input & Output
list:(Modify)List for matching filenames
ignorelist:(Modify)List of directories to ignore
Returns
ajint:number of new entries in list

Description

Recursively scan through a directory

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: none

File internal values

Sections: Values


Section: Values

Functions: ajFileValueBuffsize ajFileValueCwd ajFileValueRedirectStderr ajFileValueRedirectStdin ajFileValueRedirectStdout


Function ajFileValueBuffsize

Returns the default buffer size for a file

Synopsis

Prototype
ajuint ajFileValueBuffsize (
      void
);

TypeNameRead/WriteDescription
ajuint RETURNBuffer size default value

Returns
ajuint:Buffer size default value

Description

Returns the default buffer size for a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileValueCwd

Returns the current directory

Synopsis

Prototype
const AjPStr ajFileValueCwd (
      void
);

TypeNameRead/WriteDescription
const AjPStr RETURNDirectory name.

Returns
const AjPStr:Directory name.

Description

Returns the current directory

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileValueRedirectStderr

Tests whether stderr is in use by an internal file

Synopsis

Prototype
AjBool ajFileValueRedirectStderr (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stderr.

Returns
AjBool:ajTrue if the file matches stderr.

Description

Tests whether stderr is in use by an internal file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileValueRedirectStdin

Tests whether stdin is in use by an internal file

Synopsis

Prototype
AjBool ajFileValueRedirectStdin (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stdin.

Returns
AjBool:ajTrue if the file matches stdin.

Description

Tests whether stdin is in use by an internal file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajFileValueRedirectStdout

Tests whether stdout is in use by an internal file

Synopsis

Prototype
AjBool ajFileValueRedirectStdout (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stdout.

Returns
AjBool:ajTrue if the file matches stdout.

Description

Tests whether stdout is in use by an internal file

See Also

See other functions in this section

Availability

In release 6.4.0