ajfile.c

Datatypes:
AjPDir Directory
AjPDirout Output directory
AjPFile File object
AjPFilebuff Buffered file object
AjPOutfile Output file object
AjPStr Filename functions
AjPlist Lists of filenames
none File internal values


Datatype: AjPDir

Function is for manipulating directories and returns or takes at least one AjPDir argument.

Sections:
Directory constructorsConstructors
Directory destructorsDestructors
Directory element retrievalGeneral use


AjPDir: Directory constructors

All constructors return a directory object by pointer. It is the responsibility of the user to first destroy any previous directory pointer. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

To replace or reuse an existing file, see instead the file assignments and file modifiers functions.

The range of constructors is provided to allow flexibility in how applications can open files to read various kinds of data.

Functions:
ajDirNewPathCreates a new directory object.
ajDirNewPathExtCreates a new directory object.
ajDirNewPathPreExtCreates a new directory object.


Function ajDirNewPath

Creates a new directory object.

Prototype

AjPDir ajDirNewPath (
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
AjPDir RETURNNew directory object.

From EMBOSS 6.0.0


Function ajDirNewPathExt

Creates a new directory object.

Prototype

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

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

From EMBOSS 6.0.0


Function ajDirNewPathPreExt

Creates a new directory object.

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.

From EMBOSS 6.0.0


AjPDir: Directory destructors

Destruction is achieved by deleting the object.

Functions:
ajDirDelClose and free a directory object.


Function ajDirDel

Close and free a directory object.

Prototype

void ajDirDel (
      AjPDir* Pdir
);

TypeNameRead/WriteDescription
AjPDir*PdirDeleteDirectory object.
void RETURN

From EMBOSS 2.9.0


AjPDir: Directory element retrieval

Returns attributes of a directory

Functions:
ajDirGetExtReturns the extension(s) of a directory object
ajDirGetPathReturns the full path of a directory object
ajDirGetPrefixReturns the filename prefix(es) of a directory object
ajDirGetPrintpathReturns the full printable path of a directory object


Function ajDirGetExt

Returns the extension(s) of a directory object

Prototype

const AjPStr ajDirGetExt (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

From EMBOSS 6.0.0


Function ajDirGetPath

Returns the full path of a directory object

Prototype

const AjPStr ajDirGetPath (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

From EMBOSS 6.0.0


Function ajDirGetPrefix

Returns the filename prefix(es) of a directory object

Prototype

const AjPStr ajDirGetPrefix (
      const AjPDir thys
);

TypeNameRead/WriteDescription
const AjPDirthysInputDirectory object.
const AjPStr RETURNDirectory name

From EMBOSS 6.0.0


Function ajDirGetPrintpath

Returns the full printable path of a directory object

Prototype

const AjPStr ajDirGetPrintpath (
      const AjPDir thys
);

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

From EMBOSS 6.4.0


Datatype: AjPDirout

Function is for manipulating output directories and returns or takes at least one AjPDirout argument.

Sections:
Output directory constructorsConstructors
Output directory destructorsDestructors
Output directory element retrievalGeneral use
Output directory element testsGeneral use
Output directory element modifiersModifiers


AjPDirout: Output directory constructors

All constructors return a directory object by pointer. It is the responsibility of the user to first destroy any previous directory pointer. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

To replace or reuse an existing file, see instead the File Assignments and File Modifiers functions.

The range of constructors is provided to allow flexibility in how applications can open files to read various kinds of data.

Functions:
ajDiroutNewPathCreates a new directory output object.
ajDiroutNewPathExtCreates a new directory output object.


Function ajDiroutNewPath

Creates a new directory output object.

Prototype

AjPDirout ajDiroutNewPath (
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrpathInputDirectory name
AjPDirout RETURNNew directory object.

From EMBOSS 6.0.0


Function ajDiroutNewPathExt

Creates a new directory output object.

Prototype

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

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

From EMBOSS 6.0.0


AjPDirout: Output directory destructors

Destruction is achieved by deleting the object.

Functions:
ajDiroutDelClose and free a directory object.


Function ajDiroutDel

Close and free a directory object.

Prototype

void ajDiroutDel (
      AjPDirout* Pdir
);

TypeNameRead/WriteDescription
AjPDirout*PdirDeleteDirectory object.
void RETURN

From EMBOSS 2.9.0


AjPDirout: Output directory element retrieval

Returns attributes of a directory

Functions:
ajDiroutGetExtReturns the extension of an output directory object
ajDiroutGetPathReturns the name of an output directory object
ajDiroutGetPrintpathReturns the printable name of an output directory object


Function ajDiroutGetExt

Returns the extension of an output directory object

Prototype

const AjPStr ajDiroutGetExt (
      const AjPDirout thys
);

TypeNameRead/WriteDescription
const AjPDiroutthysInputDirectory object.
const AjPStr RETURNDirectory name

From EMBOSS 6.0.0


Function ajDiroutGetPath

Returns the name of an output directory object

Prototype

const AjPStr ajDiroutGetPath (
      const AjPDirout thys
);

TypeNameRead/WriteDescription
const AjPDiroutthysInputDirectory object.
const AjPStr RETURNDirectory name

From EMBOSS 6.0.0


Function ajDiroutGetPrintpath

Returns the printable name of an output directory object

Prototype

const AjPStr ajDiroutGetPrintpath (
      const AjPDirout thys
);

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

From EMBOSS 6.4.0


AjPDirout: Output directory element tests

Modifies attributes of a directory

Functions:
ajDiroutCreatedTests if an output directory was created when it did not already exist
ajDiroutExistsTests a directory output object is for an existing directory


Function ajDiroutCreated

Tests if an output directory was created when it did not already exist

Prototype

AjBool ajDiroutCreated (
      AjPDirout thys
);

TypeNameRead/WriteDescription
AjPDiroutthysModifyDirectory name
AjBool RETURNTrue if a newly cteated directory

From EMBOSS 6.5.0


Function ajDiroutExists

Tests a directory output object is for an existing directory

Prototype

AjBool ajDiroutExists (
      AjPDirout thys
);

TypeNameRead/WriteDescription
AjPDiroutthysModifyDirectory name
AjBool RETURNTrue on success.

From EMBOSS 6.1.0


AjPDirout: Output directory element modifiers

Modifies attributes of a directory

Functions:
ajDiroutOpenOpens a directory output object, creating it if it does not already exist


Function ajDiroutOpen

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

Prototype

AjBool ajDiroutOpen (
      AjPDirout thys
);

TypeNameRead/WriteDescription
AjPDiroutthysModifyDirectory name
AjBool RETURNTrue on success.

From EMBOSS 6.1.0


Datatype: AjPFile

Function is for manipulating buffered files and returns or takes at least one AjSFileBuff argument. Function is for manipulating file and file-related objects and usually processes an AjSOutfile, AjSDir, AjSFileBuff, AjSFileBuffList or AjSFile object.

Sections:
File constructorsConstructors
File destructorsDestructors
File reopenModifiers
File modifiersModifiers
File castsCasts
File debugMiscellaneous
File exitMiscellaneous


AjPFile: File constructors

All constructors return a new open file by pointer. It is the responsibility of the user to first destroy any previous file pointer. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

The range of constructors is provided to allow flexibility in how applications can open files to read and write various kinds of data.

Functions:
ajFileNewFromCfileCreates a new file object from an open C file.
ajFileNewInBlockSCreates a new file object to read a named file using blocked fread calls.
ajFileNewInNameCCreates a new file object to read a named file.
ajFileNewInNameSCreates a new file object to read a named file.
ajFileNewInNamePathCOpens directory "dir". Looks for file "file"
ajFileNewInNamePathSOpens directory "dir". Looks for file "file"
ajFileNewInPipeCreates a new file object to read the output from a command.
ajFileNewListinDirPreOpens directory "dir". Looks for file "file" with the extension (if any) specified for the directory
ajFileNewListinListCreates a new file object with a list of input file names.
ajFileNewListinNameDirSOpens directory "dir" and looks for file "filename".
ajFileNewListinPathWildOpens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a simple file object.
ajFileNewListinPathWildExcludeOpens 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.
ajFileNewOutNameCCreates a new output file object with a specified name.
ajFileNewOutNameSCreates a new output file object with a specified name.
ajFileNewOutNameDirSCreates a new output file object with a specified directory and name. Uses the default extension (if any) specified for the directory.
ajFileNewOutNamePathSCreates a new output file object with a specified directory and name.
ajFileNewOutappendNameSCreates 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.


Function ajFileNewFromCfile

Creates a new file object from an open C file.

Prototype

AjPFile ajFileNewFromCfile (
      FILE* file
);

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

From EMBOSS 6.0.0


Function ajFileNewInBlockS

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

Prototype

AjPFile ajFileNewInBlockS (
      const AjPStr name,
      ajuint blocksize
);

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

From EMBOSS 6.0.0


Function ajFileNewInNameC

Creates a new file object to read a named file.

Prototype

AjPFile ajFileNewInNameC (
      const char* name
);

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

From EMBOSS 6.2.0


Function ajFileNewInNameS

Creates a new file object to read a named file.

Prototype

AjPFile ajFileNewInNameS (
      const AjPStr name
);

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

From EMBOSS 6.0.0


Function ajFileNewInNamePathC

Opens directory "dir". Looks for file "file"

Prototype

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

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

From EMBOSS 6.0.0


Function ajFileNewInNamePathS

Opens directory "dir". Looks for file "file"

Prototype

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

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

From EMBOSS 6.0.0


Function ajFileNewInPipe

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

Prototype

AjPFile ajFileNewInPipe (
      const AjPStr command
);

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

From EMBOSS 1.0.0


Function ajFileNewListinDirPre

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

Prototype

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

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

From EMBOSS 6.0.0


Function ajFileNewListinList

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

Prototype

AjPFile ajFileNewListinList (
      AjPList list
);

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

From EMBOSS 6.0.0


Function ajFileNewListinNameDirS

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

Prototype

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

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

From EMBOSS 6.0.0


Function ajFileNewListinPathWild

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

Prototype

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

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

From EMBOSS 6.0.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.

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.

From EMBOSS 6.0.0


Function ajFileNewOutNameC

Creates a new output file object with a specified name.

Prototype

AjPFile ajFileNewOutNameC (
      const char* name
);

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

From EMBOSS 6.0.0


Function ajFileNewOutNameS

Creates a new output file object with a specified name.

Prototype

AjPFile ajFileNewOutNameS (
      const AjPStr name
);

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

From EMBOSS 6.0.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.

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.

From EMBOSS 6.0.0


Function ajFileNewOutNamePathS

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

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.

From EMBOSS 6.0.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.

Prototype

AjPFile ajFileNewOutappendNameS (
      const AjPStr name
);

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

From EMBOSS 6.0.0


AjPFile: File destructors

Destruction is achieved by closing the file.

Unlike ANSI C, there are tests to ensure a file is not closed twice.

Functions:
ajFileCloseClose and free a file object.


Function ajFileClose

Close and free a file object.

Prototype

void ajFileClose (
      AjPFile* Pfile
);

TypeNameRead/WriteDescription
AjPFile*PfileDeleteFile.
void RETURN

From EMBOSS 1.0.0


AjPFile: File reopen

These functions close a file and open a new file with the same file object

Functions:
ajFileReopenNameReopens an input file with a new name
ajFileReopenNextGiven a file object that includes a list of input files, closes the current input file and opens the next one.


Function ajFileReopenName

Reopens an input file with a new name

Prototype

AjBool ajFileReopenName (
      AjPFile file,
      const AjPStr name
);

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

From EMBOSS 6.0.0


Function ajFileReopenNext

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

Prototype

AjBool ajFileReopenNext (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
AjBool RETURNajTrue on success.

From EMBOSS 6.0.0


AjPFile: File modifiers

Modifying file object attributes, reset file position.

Functions:
ajFileFixResets internal file attribute after non-AJAX operations.
ajFileResetEofResets the end of file attribute after non-AJAX operations.
ajFileResetPosResets and returns the current position in an open file.
ajFileSeekSets the current position in an open file.
ajFileSetEofEnsures a binary file has reached the end of file and sets the end of file attribute
ajFileSetUnbufferTurns off system buffering of an output file, for example to allow debug output to appear even in the event of a program abort.


Function ajFileFix

Resets internal file attribute after non-AJAX operations.

Prototype

AjBool ajFileFix (
      AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileResetEof

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

Prototype

AjBool ajFileResetEof (
      AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileResetPos

Resets and returns the current position in an open file.

Prototype

ajlong ajFileResetPos (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
ajlong RETURNResult of 'ftell'

From EMBOSS 6.0.0


Function ajFileSeek

Sets the current position in an open file.

Prototype

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

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

From EMBOSS 1.0.0


Function ajFileSetEof

Ensures a binary file has reached the end of file and sets the end of file attribute

Prototype

AjBool ajFileSetEof (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile.
AjBool RETURNTrue if end of file was already

From EMBOSS 6.5.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.

Prototype

void ajFileSetUnbuffer (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyFile object.
void RETURN

From EMBOSS 6.0.0


AjPFile: File casts

Returns attributes of a file object

Functions:
ajFileGetFileptrReturns the C file pointer for an open file.
ajFileGetNameCReturns 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.
ajFileGetNameSReturns 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.
ajFileGetPrintnameCReturns 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.
ajFileGetPrintnameSReturns 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.
ajFileIsAppendReturns the App element for a file object. The App element is True if the file was opened for appending to, False otherwise.
ajFileIsEofTests whether we have reached end of file already
ajFileIsFileTests whether a file object is really a regular file.
ajFileIsStderrTests whether a file object is really stderr.
ajFileIsStdinTests whether a file object is really stdin.
ajFileIsStdoutTests whether a file object is really stdout.


Function ajFileGetFileptr

Returns the C file pointer for an open file.

Prototype

FILE* ajFileGetFileptr (
      const AjPFile file
);

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

From EMBOSS 6.0.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.

Prototype

const char* ajFileGetNameC (
      const AjPFile file
);

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

From EMBOSS 6.0.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.

Prototype

const AjPStr ajFileGetNameS (
      const AjPFile file
);

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

From EMBOSS 6.0.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.

Prototype

const char* ajFileGetPrintnameC (
      const AjPFile file
);

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

From EMBOSS 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.

Prototype

const AjPStr ajFileGetPrintnameS (
      const AjPFile file
);

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

From EMBOSS 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.

Prototype

AjBool ajFileIsAppend (
      const AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileIsEof

Tests whether we have reached end of file already

Prototype

AjBool ajFileIsEof (
      const AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileIsFile

Tests whether a file object is really a regular file.

Prototype

AjBool ajFileIsFile (
      const AjPFile file
);

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

From EMBOSS 6.3.0


Function ajFileIsStderr

Tests whether a file object is really stderr.

Prototype

AjBool ajFileIsStderr (
      const AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileIsStdin

Tests whether a file object is really stdin.

Prototype

AjBool ajFileIsStdin (
      const AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFileIsStdout

Tests whether a file object is really stdout.

Prototype

AjBool ajFileIsStdout (
      const AjPFile file
);

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

From EMBOSS 6.0.0


AjPFile: File debug

report file object contents for debugging

Functions:
ajFileTraceWrites debug messages to trace the contents of a file object.


Function ajFileTrace

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

Prototype

void ajFileTrace (
      const AjPFile file
);

TypeNameRead/WriteDescription
const AjPFilefileInputFile.
void RETURN

From EMBOSS 1.0.0


AjPFile: File exit

Cleanup memory on program exit

Functions:
ajFileExitPrints a summary of file usage with debug calls


Function ajFileExit

Prints a summary of file usage with debug calls

Prototype

void ajFileExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

From EMBOSS 1.0.0


Datatype: AjPFilebuff

Function is for manipulating buffered files and returns or takes at least one AjSFileBuff argument.

Sections:
Buffered file constructorsConstructors
Buffered file destructorsDestructors
Buffered file reopenModifiers
Buffered file modifiersModifiers
Buffered file content modifiersModifiers
Buffered file operatorsGeneral use
Buffered file debugMiscellaneous


AjPFilebuff: Buffered file constructors

All constructors return a new open file by pointer. It is the responsibility of the user to first destroy any previous file pointer. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

To replace or reuse an existing file, see instead the File Assignments and File Modifiers functions.

The range of constructors is provided to allow flexibility in how applications can open files to read various kinds of data.

Functions:
ajFilebuffNewFromCfileCreates a new buffered input file from an already open C file.
ajFilebuffNewFromFileCreates a new buffered input file object from an open file.
ajFilebuffNewLineCreates a new buffered input file object with no file but with one line of buffered data provided.
ajFilebuffNewListinListCreates a new buffered file object from a list of filenames.
ajFilebuffNewNameSCreates a new buffered input file object with an opened named file.
ajFilebuffNewNamePathCOpens directory "dir", finds and opens file "name"
ajFilebuffNewNamePathSOpens directory "dir", finds and opens file "name"
ajFilebuffNewNofileCreates a new buffered input file object with an undefined file to be used as a text buffer.
ajFilebuffNewPathWildOpens directory "dir" Looks for file(s) matching "file" Opens them as a list of files using a buffered file object.
ajFilebuffNewPathWildExcludeOpens 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.


Function ajFilebuffNewFromCfile

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

Prototype

AjPFilebuff ajFilebuffNewFromCfile (
      FILE* file
);

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

From EMBOSS 6.0.0


Function ajFilebuffNewFromFile

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

Prototype

AjPFilebuff ajFilebuffNewFromFile (
      AjPFile file
);

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

From EMBOSS 6.0.0


Function ajFilebuffNewLine

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

Prototype

AjPFilebuff ajFilebuffNewLine (
      const AjPStr line
);

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

From EMBOSS 6.0.0


Function ajFilebuffNewListinList

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

Prototype

AjPFilebuff ajFilebuffNewListinList (
      AjPList list
);

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

From EMBOSS 6.0.0


Function ajFilebuffNewNameS

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

Prototype

AjPFilebuff ajFilebuffNewNameS (
      const AjPStr name
);

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

From EMBOSS 6.0.0


Function ajFilebuffNewNamePathC

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

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.

From EMBOSS 6.0.0


Function ajFilebuffNewNamePathS

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

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.

From EMBOSS 6.0.0


Function ajFilebuffNewNofile

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

Prototype

AjPFilebuff ajFilebuffNewNofile (
      void
);

TypeNameRead/WriteDescription
AjPFilebuff RETURNNew buffered file object.

From EMBOSS 6.0.0


Function ajFilebuffNewPathWild

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

Prototype

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

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

From EMBOSS 6.0.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.

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.

From EMBOSS 6.0.0


AjPFilebuff: Buffered file destructors

Destruction is achieved by closing the file.

Unlike ANSI C, there are tests to ensure a file is not closed twice.

Functions:
ajFilebuffDelDestructor for a buffered file object.


Function ajFilebuffDel

Destructor for a buffered file object.

Prototype

void ajFilebuffDel (
      AjPFilebuff* Pbuff
);

TypeNameRead/WriteDescription
AjPFilebuff*PbuffDeleteBuffered file object.
void RETURN

From EMBOSS 6.0.0


AjPFilebuff: Buffered file reopen

These functions close a file and open a new file with the same file object

Functions:
ajFilebuffReopenFileSets buffered input file to use a new open file.


Function ajFilebuffReopenFile

Sets buffered input file to use a new open file.

Prototype

AjBool ajFilebuffReopenFile (
      AjPFilebuff* Pbuff,
      AjPFile file
);

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

From EMBOSS 6.0.0


AjPFilebuff: Buffered file modifiers

These functions use the attributes of a buffered file object and update them.

Functions:
ajFilebuffClearDeletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.
ajFilebuffClearStoreDeletes processed lines from a file buffer. The buffer has a record (Pos) of the next unprocessed line in the buffer.
ajFilebuffFixResets 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.
ajFilebuffResetResets the pointer and current record of a file buffer so the next read starts at the first buffered line.
ajFilebuffResetPosResets the pointer and current record of a file buffer so the next read starts at the first buffered line.
ajFilebuffResetStoreResets the pointer and current record of a file buffer so the next read starts at the first buffered line.
ajFilebuffSetBufferedSets file to be buffered. If it already has buffered data, we have to first run down the buffer.
ajFilebuffSetUnbufferedSets file to be unbuffered. If it already has buffered data, we have to first run down the buffer.


Function ajFilebuffClear

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

Prototype

void ajFilebuffClear (
      AjPFilebuff buff,
      ajint lines
);

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

From EMBOSS 6.0.0


Function ajFilebuffClearStore

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

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

From EMBOSS 6.0.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.

Prototype

void ajFilebuffFix (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

From EMBOSS 6.0.0


Function ajFilebuffReset

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

Prototype

void ajFilebuffReset (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

From EMBOSS 6.0.0


Function ajFilebuffResetPos

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

Prototype

void ajFilebuffResetPos (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyFile buffer
void RETURN

From EMBOSS 6.0.0


Function ajFilebuffResetStore

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

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

From EMBOSS 6.0.0


Function ajFilebuffSetBuffered

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

Prototype

AjBool ajFilebuffSetBuffered (
      AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffSetUnbuffered

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

Prototype

AjBool ajFilebuffSetUnbuffered (
      AjPFilebuff buff
);

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

From EMBOSS 6.0.0


AjPFilebuff: Buffered file content modifiers

These functions use the buffer contents of a buffered file object and update them.

Functions:
ajFilebuffHtmlNoheaderProcesses data in the file buffer, removing HTML titles and decoding possible chunked input
ajFilebuffHtmlPreIf we only have one pre-formatted section in HTML, that is all we keep.
ajFilebuffHtmlStripProcesses data in the file buffer, removing HTML tokens between angle brackets, plus any TITLE. This seems to be enough to make HTML output readable.
ajFilebuffLoadCAdds a line to the buffer.
ajFilebuffLoadSAdds a copy of a line to the buffer.
ajFilebuffLoadAllReads all input lines from a file into the buffer.
ajFilebuffLoadReadurlReads from a URL and loads all input lines into the buffer.


Function ajFilebuffHtmlNoheader

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

Prototype

ajuint ajFilebuffHtmlNoheader (
      AjPFilebuff buff
);

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

From EMBOSS 6.2.0


Function ajFilebuffHtmlPre

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

Prototype

AjBool ajFilebuffHtmlPre (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifybuffer
AjBool RETURNajTrue=cleaned ajFalse=unchanged

From EMBOSS 6.0.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.

Prototype

void ajFilebuffHtmlStrip (
      AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffLoadC

Adds a line to the buffer.

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilebuffLoadS

Adds a copy of a line to the buffer.

Prototype

void ajFilebuffLoadS (
      AjPFilebuff buff,
      const AjPStr line
);

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

From EMBOSS 6.0.0


Function ajFilebuffLoadAll

Reads all input lines from a file into the buffer.

Prototype

void ajFilebuffLoadAll (
      AjPFilebuff buff
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyBuffered file.
void RETURN

From EMBOSS 6.0.0


Function ajFilebuffLoadReadurl

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

Prototype

AjBool ajFilebuffLoadReadurl (
      AjPFilebuff buff,
      const AjPStr url
);

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

From EMBOSS 6.4.0


AjPFilebuff: Buffered file operators

These functions use the contents of a file object but do not make any changes.

Functions:
ajFilebuffGetFileReturns the file object from a buffered file object.
ajFilebuffGetFileptrReturns the C file pointer for an open buffered file.
ajFilebuffGetFirstReturns the first line of a file buffer
ajFilebuffIsBufferedTests whether an input file is buffered.
ajFilebuffIsEmptyTests whether a file buffer is empty, including testing for a possible next file
ajFilebuffIsEndedTests whether the current file is exhausted. This means end of file is reached and the buffer is empty.
ajFilebuffIsEofTests whether we have reached end of file already


Function ajFilebuffGetFile

Returns the file object from a buffered file object.

Prototype

AjPFile ajFilebuffGetFile (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
AjPFile RETURNFile object.

From EMBOSS 6.0.0


Function ajFilebuffGetFileptr

Returns the C file pointer for an open buffered file.

Prototype

FILE* ajFilebuffGetFileptr (
      const AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffGetFirst

Returns the first line of a file buffer

Prototype

const AjPStr ajFilebuffGetFirst (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputFile buffer
const AjPStr RETURNFirst line

From EMBOSS 6.4.0


Function ajFilebuffIsBuffered

Tests whether an input file is buffered.

Prototype

AjBool ajFilebuffIsBuffered (
      const AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffIsEmpty

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

Prototype

AjBool ajFilebuffIsEmpty (
      const AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffIsEnded

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

Prototype

AjBool ajFilebuffIsEnded (
      const AjPFilebuff buff
);

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

From EMBOSS 6.0.0


Function ajFilebuffIsEof

Tests whether we have reached end of file already

Prototype

AjBool ajFilebuffIsEof (
      const AjPFilebuff buff
);

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

From EMBOSS 6.0.0


AjPFilebuff: Buffered file debug

Report file object contents for debugging

Functions:
ajFilebuffTraceWrites debug messages to indicate the contents of a buffered file.
ajFilebuffTraceFullWrites debug messages to show the full contents of a buffered file.
ajFilebuffTraceTitleWrites the full contents of a buffered file to the debug file


Function ajFilebuffTrace

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

Prototype

void ajFilebuffTrace (
      const AjPFilebuff buff
);

TypeNameRead/WriteDescription
const AjPFilebuffbuffInputBuffered file.
void RETURN

From EMBOSS 6.0.0


Function ajFilebuffTraceFull

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

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

From EMBOSS 6.0.0


Function ajFilebuffTraceTitle

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

Prototype

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

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

From EMBOSS 6.0.0


Datatype: AjPOutfile

Function is for manipulating output files and their attributes.

Sections:
Outfile constructorsConstructors
Outfile destructorsDestructors
Outfile castsCasts
Outfile modifiersModifiers


AjPOutfile: Outfile constructors

All constructors return a new open file by pointer. It is the responsibility of the user to first destroy any previous file pointer. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

To replace or reuse an existing file, see instead the File Assignments and File Modifiers functions.

The range of constructors is provided to allow flexibility in how applications can open files to read various kinds of data.

Functions:
ajOutfileNewNameSCreates a new formatted output file object with a specified name.


Function ajOutfileNewNameS

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

Prototype

AjPOutfile ajOutfileNewNameS (
      const AjPStr name
);

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

From EMBOSS 6.0.0


AjPOutfile: Outfile destructors

Destruction is achieved by closing the file.

Unlike ANSI C, there are tests to ensure a file is not closed twice.

Functions:
ajOutfileCloseClose and free an outfile object.


Function ajOutfileClose

Close and free an outfile object.

Prototype

void ajOutfileClose (
      AjPOutfile* Pfile
);

TypeNameRead/WriteDescription
AjPOutfile*PfileDeleteOutput file.
void RETURN

From EMBOSS 2.9.0


AjPOutfile: Outfile casts

These functions examine the contents of an outfile object and return some derived information. Some of them provide access to the internal components of a file object. They are provided for programming convenience but should be used with caution.

Functions:
ajOutfileGetFileReturns the AjPFile for an AjPOutfile object
ajOutfileGetFileptrReturns the C FILE* for an AjPOutfile object
ajOutfileGetFormatReturns the file format name for an AjPOutfile object
ajOutfileGetFormatindexReturns the file format name for an AjPOutfile object


Function ajOutfileGetFile

Returns the AjPFile for an AjPOutfile object

Prototype

AjPFile ajOutfileGetFile (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
AjPFile RETURNAjPFile object

From EMBOSS 6.0.0


Function ajOutfileGetFileptr

Returns the C FILE* for an AjPOutfile object

Prototype

FILE* ajOutfileGetFileptr (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
FILE* RETURNC file pointer

From EMBOSS 6.0.0


Function ajOutfileGetFormat

Returns the file format name for an AjPOutfile object

Prototype

const AjPStr ajOutfileGetFormat (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
const AjPStr RETURNFormat name

From EMBOSS 6.0.0


Function ajOutfileGetFormatindex

Returns the file format name for an AjPOutfile object

Prototype

ajuint ajOutfileGetFormatindex (
      const AjPOutfile file
);

TypeNameRead/WriteDescription
const AjPOutfilefileInputOutfile object
ajuint RETURNFormat name

From EMBOSS 6.4.0


AjPOutfile: Outfile modifiers

These functions modify an output file object and its asociated output file

Functions:
ajOutfileResetClose and free an outfile object.


Function ajOutfileReset

Close and free an outfile object.

Prototype

void ajOutfileReset (
      AjPOutfile outf
);

TypeNameRead/WriteDescription
AjPOutfileoutfModifyOutput file.
void RETURN

From EMBOSS 6.5.0


Datatype: AjPStr

Functions operating on strings containing filenames

Sections:
Filename testsGeneral use
Filename modifiersModifiers


AjPStr: Filename tests

Tests on filenames and searching the file system

Functions:
ajFilenameExistsReturns true if file exists
ajFilenameExistsDirReturns true if file exists and is a directory
ajFilenameExistsExecReturns true if file exists and is executable by the user
ajFilenameExistsReadReturns true if file exists and is readable by the user
ajFilenameExistsWriteReturns true if file exists and is writable by the user
ajFilenameGetSizeReturns the length of a file
ajFilenameHasPathTests whether a filename includes a directory specification.
ajFilenameTestExcludeTests a filename against wildcard lists of file names to be included and excluded.
ajFilenameTestExcludePathTests a full path filename against wildcard lists of file names to be included and excluded.
ajFilenameTestIncludeTests a filename against wildcard lists of file names to be included and excluded.
ajFilenameTestIncludePathTests a filename against wildcard lists of file names to be included and excluded.


Function ajFilenameExists

Returns true if file exists

Prototype

AjBool ajFilenameExists (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

From EMBOSS 6.0.0


Function ajFilenameExistsDir

Returns true if file exists and is a directory

Prototype

AjBool ajFilenameExistsDir (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

From EMBOSS 6.0.0


Function ajFilenameExistsExec

Returns true if file exists and is executable by the user

Prototype

AjBool ajFilenameExistsExec (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

From EMBOSS 6.0.0


Function ajFilenameExistsRead

Returns true if file exists and is readable by the user

Prototype

AjBool ajFilenameExistsRead (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

From EMBOSS 6.0.0


Function ajFilenameExistsWrite

Returns true if file exists and is writable by the user

Prototype

AjBool ajFilenameExistsWrite (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename.
AjBool RETURNajTrue on success

From EMBOSS 6.0.0


Function ajFilenameGetSize

Returns the length of a file

Prototype

ajlong ajFilenameGetSize (
      const AjPStr filename
);

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

From EMBOSS 6.0.0


Function ajFilenameHasPath

Tests whether a filename includes a directory specification.

Prototype

AjBool ajFilenameHasPath (
      const AjPStr filename
);

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

From EMBOSS 6.0.0


Function ajFilenameTestExclude

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

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.

From EMBOSS 6.0.0


Function ajFilenameTestExcludePath

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

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.

From EMBOSS 6.0.0


Function ajFilenameTestInclude

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

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.

From EMBOSS 6.0.0


Function ajFilenameTestIncludePath

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

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.

From EMBOSS 6.0.0


AjPStr: Filename modifiers

These functions overwrite a previous filename

Functions:
ajFilenameReplaceExtCReplaces the extension part of a filename
ajFilenameReplaceExtSReplaces the extension part of a filename
ajFilenameReplacePathCSets the directory part of a filename
ajFilenameReplacePathSSets the directory part of a filename
ajFilenameSetExtCSets the extension part of a filename
ajFilenameSetExtSSets the extension part of a base filename
ajFilenameSetTempnameReturns 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.
ajFilenameSetTempnamePathCReturns 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.
ajFilenameSetTempnamePathSReturns 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.
ajFilenameTrimAllTruncates a filename to a basic file name.
ajFilenameTrimExtTrims the extension (if any) from a filename
ajFilenameTrimPathTrims the directory path (if any) from a filename
ajFilenameTrimPathExtTrims the directory path (if any) and extension (if any) from a filename.


Function ajFilenameReplaceExtC

Replaces the extension part of a filename

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilenameReplaceExtS

Replaces the extension part of a filename

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilenameReplacePathC

Sets the directory part of a filename

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilenameReplacePathS

Sets the directory part of a filename

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilenameSetExtC

Sets the extension part of a filename

Prototype

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

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

From EMBOSS 6.3.0


Function ajFilenameSetExtS

Sets the extension part of a base filename

Prototype

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

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

From EMBOSS 6.3.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.

Prototype

AjBool ajFilenameSetTempname (
      AjPStr* Pfilename
);

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

From EMBOSS 6.0.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.

Prototype

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

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

From EMBOSS 6.0.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.

Prototype

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

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

From EMBOSS 6.0.0


Function ajFilenameTrimAll

Truncates a filename to a basic file name.

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.

From EMBOSS 6.0.0


Function ajFilenameTrimExt

Trims the extension (if any) from a filename

Prototype

AjBool ajFilenameTrimExt (
      AjPStr* Pfilename
);

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

From EMBOSS 6.0.0


Function ajFilenameTrimPath

Trims the directory path (if any) from a filename

Prototype

AjBool ajFilenameTrimPath (
      AjPStr* Pfilename
);

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

From EMBOSS 6.0.0


Function ajFilenameTrimPathExt

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

Prototype

AjBool ajFilenameTrimPathExt (
      AjPStr* Pfilename
);

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

From EMBOSS 6.0.0


AjPStr: Filename tests

Tests on filenames and searching the file system

Functions:
ajFilewildnameExistsReturns true if wildcard filename matches an existing file
ajFilewildnameExistsDirOpens directory "dir" Looks for file(s) matching wildcard filename


Function ajFilewildnameExists

Returns true if wildcard filename matches an existing file

Prototype

AjBool ajFilewildnameExists (
      const AjPStr wildname
);

TypeNameRead/WriteDescription
const AjPStrwildnameInputWildcard filename.
AjBool RETURNajTrue on success

From EMBOSS 6.6.0


Function ajFilewildnameExistsDir

Opens directory "dir" Looks for file(s) matching wildcard filename

Prototype

AjBool ajFilewildnameExistsDir (
      const AjPStr wildname,
      const AjPStr path
);

TypeNameRead/WriteDescription
const AjPStrwildnameInputWildcard filename.
const AjPStrpathInputDirectory
AjBool RETURNTrue if one or more files matched.

From EMBOSS 6.6.0


AjPStr: Directory name modifiers

These functions overwrite a previous filename

Functions:
ajDirnameFillPathChecks that a string is a valid directory, and makes sure it has the full path definition.
ajDirnameFixIf the directory name has no trailing slash (on Unix) then one is added. This is why the directory name must be writable.
ajDirnameFixExistsChecks that a string is a valid existing directory, and appends a trailing '/' if it is missing.
ajDirnameUpChanges directory name to one level up


Function ajDirnameFillPath

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

Prototype

AjBool ajDirnameFillPath (
      AjPStr* Pdirname
);

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

From EMBOSS 6.0.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.

Prototype

void ajDirnameFix (
      AjPStr* Pdirname
);

TypeNameRead/WriteDescription
AjPStr*PdirnameModifyDirectory name.
void RETURN

From EMBOSS 6.0.0


Function ajDirnameFixExists

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

Prototype

AjBool ajDirnameFixExists (
      AjPStr* Pdirname
);

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

From EMBOSS 6.0.0


Function ajDirnameUp

Changes directory name to one level up

Prototype

AjBool ajDirnameUp (
      AjPStr* Pdirname
);

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

From EMBOSS 6.0.0


AjPStr: Directory name functions

Functions using a directory name

Functions:
ajDirnamePrintRecursiveIgnoreRecursively scan through a directory, printing directory and file names


Function ajDirnamePrintRecursiveIgnore

Recursively scan through a directory, printing directory and file names

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

From EMBOSS 6.0.0


Datatype: AjPlist

Functions building and managing lists of filenames

Sections:
File list additionModifiers


AjPlist: File list addition

Functions that add filenames to a list

Functions:
ajFilelistAddDirectoryScan 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.
ajFilelistAddListnameAdds to a list of files that match a comma-separated string of filenames which can include wildcards or listfiles
ajFilelistAddPathScan through a directory returning all filenames excluding directory names
ajFilelistAddPathDirScan through a directory returning all filenames and directory names except '.' and '..', including directories
ajFilelistAddPathWildScan through a directory returning all filenames matching a wildcard filename
ajFilelistAddPathWildDirScan through a directory returning all filenames matching a wildcard filename, including directories
ajFilelistAddPathWildRecursiveIgnoreRecursively scan through a directory


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.

Prototype

ajint ajFilelistAddDirectory (
      AjPList list,
      const AjPDir dir
);

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

From EMBOSS 6.3.0


Function ajFilelistAddListname

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

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

From EMBOSS 6.0.0


Function ajFilelistAddPath

Scan through a directory returning all filenames excluding directory names

Prototype

ajint ajFilelistAddPath (
      AjPList list,
      const AjPStr path
);

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

From EMBOSS 6.0.0


Function ajFilelistAddPathDir

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

Prototype

ajint ajFilelistAddPathDir (
      AjPList list,
      const AjPStr path
);

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

From EMBOSS 6.0.0


Function ajFilelistAddPathWild

Scan through a directory returning all filenames matching a wildcard filename

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

From EMBOSS 6.0.0


Function ajFilelistAddPathWildDir

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

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

From EMBOSS 6.0.0


Function ajFilelistAddPathWildRecursiveIgnore

Recursively scan through a directory

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

From EMBOSS 6.0.0


Datatype: none

Functions returning internal values and system parameters

Sections:
Internal valuesMiscellaneous


Section: Internal values

Internal values and system parameters

Functions:
ajFileValueBuffsizeReturns the default buffer size for a file
ajFileValueCwdReturns the current directory
ajFileValueRedirectStderrTests whether stderr is in use by an internal file
ajFileValueRedirectStdinTests whether stdin is in use by an internal file
ajFileValueRedirectStdoutTests whether stdout is in use by an internal file


Function ajFileValueBuffsize

Returns the default buffer size for a file

Prototype

ajuint ajFileValueBuffsize (
      void
);

TypeNameRead/WriteDescription
ajuint RETURNBuffer size default value

From EMBOSS 6.0.0


Function ajFileValueCwd

Returns the current directory

Prototype

const AjPStr ajFileValueCwd (
      void
);

TypeNameRead/WriteDescription
const AjPStr RETURNDirectory name.

From EMBOSS 6.0.0


Function ajFileValueRedirectStderr

Tests whether stderr is in use by an internal file

Prototype

AjBool ajFileValueRedirectStderr (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stderr.

From EMBOSS 6.0.0


Function ajFileValueRedirectStdin

Tests whether stdin is in use by an internal file

Prototype

AjBool ajFileValueRedirectStdin (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stdin.

From EMBOSS 6.0.0


Function ajFileValueRedirectStdout

Tests whether stdout is in use by an internal file

Prototype

AjBool ajFileValueRedirectStdout (
      void
);

TypeNameRead/WriteDescription
AjBool RETURNajTrue if the file matches stdout.

From EMBOSS 6.0.0