ajfile.c
Datatypes: AjPDir AjPDirout AjPFile AjPFilebuff AjPOutfile AjPStr AjPlist none
Directory
Sections: Directory Constructors Directory Destructors Directory element retrieval
Functions: ajDirNewPath ajDirNewPathExt ajDirNewPathPreExt
Creates a new directory object.
Synopsis
Prototype
AjPDir ajDirNewPath (
const AjPStr path
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory name |
AjPDir | | RETURN | New 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
Creates a new directory object.
Synopsis
Prototype
AjPDir ajDirNewPathExt (
const AjPStr path,
const AjPStr ext
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory name |
const AjPStr | ext | Input | File extension |
AjPDir | | RETURN | New 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
Creates a new directory object.
Synopsis
Prototype
AjPDir ajDirNewPathPreExt (
const AjPStr path,
const AjPStr prefix,
const AjPStr ext
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory name |
const AjPStr | prefix | Input | Filename prefix |
const AjPStr | ext | Input | Filename extension |
AjPDir | | RETURN | New 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
Functions: ajDirDel
Close and free a directory object.
Synopsis
Prototype
void ajDirDel (
AjPDir* Pdir
);
Type | Name | Read/Write | Description |
AjPDir* | Pdir | Delete | Directory object. |
void | | RETURN | |
Output
Pdir: | (Delete) | Directory object. |
Returns
Description
Close and free a directory object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajDirGetExt ajDirGetPath ajDirGetPrefix ajDirGetPrintpath
Returns the extension(s) of a directory object
Synopsis
Prototype
const AjPStr ajDirGetExt (
const AjPDir thys
);
Type | Name | Read/Write | Description |
const AjPDir | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Returns the full path of a directory object
Synopsis
Prototype
const AjPStr ajDirGetPath (
const AjPDir thys
);
Type | Name | Read/Write | Description |
const AjPDir | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Returns the filename prefix(es) of a directory object
Synopsis
Prototype
const AjPStr ajDirGetPrefix (
const AjPDir thys
);
Type | Name | Read/Write | Description |
const AjPDir | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Returns the full printable path of a directory object
Synopsis
Prototype
const AjPStr ajDirGetPrintpath (
const AjPDir thys
);
Type | Name | Read/Write | Description |
const AjPDir | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Output directory
Sections: Output directory Constructors Output directory Destructors Output directory element retrieval Output directory element modifiers
Functions: ajDiroutNewPath ajDiroutNewPathExt
Creates a new directory output object.
Synopsis
Prototype
AjPDirout ajDiroutNewPath (
const AjPStr path
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory name |
AjPDirout | | RETURN | New 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
Creates a new directory output object.
Synopsis
Prototype
AjPDirout ajDiroutNewPathExt (
const AjPStr path,
const AjPStr ext
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory name |
const AjPStr | ext | Input | File extension |
AjPDirout | | RETURN | New 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
Functions: ajDiroutDel
Close and free a directory object.
Synopsis
Prototype
void ajDiroutDel (
AjPDirout* Pdir
);
Type | Name | Read/Write | Description |
AjPDirout* | Pdir | Delete | Directory object. |
void | | RETURN | |
Output
Pdir: | (Delete) | Directory object. |
Returns
Description
Close and free a directory object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajDiroutGetExt ajDiroutGetPath ajDiroutGetPrintpath
Returns the extension of an output directory object
Synopsis
Prototype
const AjPStr ajDiroutGetExt (
const AjPDirout thys
);
Type | Name | Read/Write | Description |
const AjPDirout | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Returns the name of an output directory object
Synopsis
Prototype
const AjPStr ajDiroutGetPath (
const AjPDirout thys
);
Type | Name | Read/Write | Description |
const AjPDirout | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Returns the printable name of an output directory object
Synopsis
Prototype
const AjPStr ajDiroutGetPrintpath (
const AjPDirout thys
);
Type | Name | Read/Write | Description |
const AjPDirout | thys | Input | Directory object. |
const AjPStr | | RETURN | Directory 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
Functions: ajDiroutExists ajDiroutOpen
Tests a directory output object is for an existing directory
Synopsis
Prototype
AjBool ajDiroutExists (
AjPDirout thys
);
Type | Name | Read/Write | Description |
AjPDirout | thys | Modify | Directory name |
AjBool | | RETURN | True on success. |
Input & Output
thys: | (Modify) | Directory name |
Returns
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
Opens a directory output object, creating it if it does not already exist
Synopsis
Prototype
AjBool ajDiroutOpen (
AjPDirout thys
);
Type | Name | Read/Write | Description |
AjPDirout | thys | Modify | Directory name |
AjBool | | RETURN | True on success. |
Input & Output
thys: | (Modify) | Directory name |
Returns
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
File object
Sections: File Constructors File Destructors file reopen File modifiers file casts file debug file exit
Functions: ajFileNewFromCfile ajFileNewInBlockS ajFileNewInNameC ajFileNewInNameS ajFileNewInNamePathC ajFileNewInNamePathS ajFileNewInPipe ajFileNewListinDirPre ajFileNewListinList ajFileNewListinNameDirS ajFileNewListinPathWild ajFileNewListinPathWildExclude ajFileNewOutNameC ajFileNewOutNameS ajFileNewOutNameDirS ajFileNewOutNamePathS ajFileNewOutappendNameS
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
);
Type | Name | Read/Write | Description |
FILE* | file | Modify | C file. |
AjPFile | | RETURN | New file object. |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
ajuint | blocksize | Input | Block size |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | File name. |
blocksize: | (Input) | Block size |
Returns
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
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
);
Type | Name | Read/Write | Description |
const char* | name | Input | File name. |
AjPFile | | RETURN | New file object. |
Input
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
AjPFile | | RETURN | New file object. |
Input
Returns
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
Opens directory "dir"
Looks for file "file"
Synopsis
Prototype
AjPFile ajFileNewInNamePathC (
const char* name,
const AjPStr path
);
Type | Name | Read/Write | Description |
const char* | name | Input | Filename. |
const AjPStr | path | Input | Directory |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | Filename. |
path: | (Input) | Directory |
Returns
Description
Opens directory "dir"
Looks for file "file"
See Also
See other functions in this section
Availability
In release 6.4.0
Opens directory "dir"
Looks for file "file"
Synopsis
Prototype
AjPFile ajFileNewInNamePathS (
const AjPStr name,
const AjPStr path
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | Filename. |
const AjPStr | path | Input | Directory |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | Filename. |
path: | (Input) | Directory |
Returns
Description
Opens directory "dir"
Looks for file "file"
See Also
See other functions in this section
Availability
In release 6.4.0
Creates a new file object to read the output from a command.
Synopsis
Prototype
AjPFile ajFileNewInPipe (
const AjPStr command
);
Type | Name | Read/Write | Description |
const AjPStr | command | Input | Command string.
The string may end with a trailing pipe character. |
AjPFile | | RETURN | New file object. |
Input
command: | (Input) | Command string.
The string may end with a trailing pipe character. |
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPDir | dir | Input | Directory |
const AjPStr | prefix | Input | Wildcard Filename. |
AjPFile | | RETURN | New file object. |
Input
dir: | (Input) | Directory |
prefix: | (Input) | Wildcard Filename. |
Returns
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
Creates a new file object with a list of input file names.
Synopsis
Prototype
AjPFile ajFileNewListinList (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List of input filenames as strings. |
AjPFile | | RETURN | New file object. |
Input & Output
list: | (Modify) | List of input filenames as strings. |
Returns
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
Opens directory "dir" and looks for file "filename"
Synopsis
Prototype
AjPFile ajFileNewListinNameDirS (
const AjPStr name,
const AjPDir dir
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | Wildcard Filename. |
const AjPDir | dir | Input | Directory |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | Wildcard Filename. |
dir: | (Input) | Directory |
Returns
Description
Opens directory "dir" and looks for file "filename"
See Also
See other functions in this section
Availability
In release 6.4.0
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
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory |
const AjPStr | wildname | Input | Wildcard filename. |
AjPFile | | RETURN | New file object. |
Input
path: | (Input) | Directory |
wildname: | (Input) | Wildcard filename. |
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory path |
const AjPStr | wildname | Input | Wildcard filename. |
const AjPStr | exclude | Input | Wildcard excluded filename. |
AjPFile | | RETURN | New file object. |
Input
path: | (Input) | Directory path |
wildname: | (Input) | Wildcard filename. |
exclude: | (Input) | Wildcard excluded filename. |
Returns
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
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
);
Type | Name | Read/Write | Description |
const char* | name | Input | File name. |
AjPFile | | RETURN | New file object. |
Input
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
AjPFile | | RETURN | New file object. |
Input
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
const AjPDirout | dir | Input | Directory
(optional, can be empty or NULL). |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | File name. |
dir: | (Input) | Directory
(optional, can be empty or NULL). |
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
const AjPStr | path | Input | Directory (optional, can be empty or NULL). |
AjPFile | | RETURN | New file object. |
Input
name: | (Input) | File name. |
path: | (Input) | Directory (optional, can be empty or NULL). |
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
AjPFile | | RETURN | New file object. |
Input
Returns
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
Functions: ajFileClose
Close and free a file object.
Synopsis
Prototype
void ajFileClose (
AjPFile* Pfile
);
Type | Name | Read/Write | Description |
AjPFile* | Pfile | Delete | File. |
void | | RETURN | |
Output
Returns
Description
Close and free a file object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajFileReopenName ajFileReopenNext
Reopens an input file with a new name
Synopsis
Prototype
AjBool ajFileReopenName (
AjPFile file,
const AjPStr name
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | Input file. |
const AjPStr | name | Input | name of file. |
AjBool | | RETURN | True on success |
Input
name: | (Input) | name of file. |
Input & Output
Returns
Description
Reopens an input file with a new name
See Also
See other functions in this section
Availability
In release 6.4.0
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
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File object. |
AjBool | | RETURN | ajTrue 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
Functions: ajFileFix ajFileResetEof ajFileResetPos ajFileSeek ajFileSetUnbuffer
Resets internal file attribute after non-AJAX operations.
Synopsis
Prototype
AjBool ajFileFix (
AjPFile file
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File. |
AjBool | | RETURN | True if end of file is reached |
Input & Output
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
Resets the end of file attribute after non-AJAX operations.
Synopsis
Prototype
AjBool ajFileResetEof (
AjPFile file
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File. |
AjBool | | RETURN | True if end of file is set |
Input & Output
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
Resets and returns the current position in an open file.
Synopsis
Prototype
ajlong ajFileResetPos (
AjPFile file
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File. |
ajlong | | RETURN | Result of 'ftell' |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File. |
ajlong | offset | Input | Offset |
ajint | wherefrom | Input | Start of offset, as defined for 'fseek'. |
ajint | | RETURN | Result of 'fseek' |
Input
offset: | (Input) | Offset |
wherefrom: | (Input) | Start of offset, as defined for 'fseek'. |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File object. |
void | | RETURN | |
Input & Output
file: | (Modify) | File object. |
Returns
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
Functions: ajFileGetFileptr ajFileGetNameC ajFileGetNameS ajFileGetPrintnameC ajFileGetPrintnameS ajFileIsAppend ajFileIsEof ajFileIsFile ajFileIsStderr ajFileIsStdin ajFileIsStdout
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
FILE* | | RETURN | C file pointer for the file. |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
const char* | | RETURN | Filename as a C character string. |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
const AjPStr | | RETURN | Filename as a C character string. |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
const char* | | RETURN | Printable filename as a C character string. |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
const AjPStr | | RETURN | Printable filename as a C character string. |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
AjBool | | RETURN | App element, True if if file was opened for appending to,
False otherwise. |
Input
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
Tests whether we have reached end of file already
Synopsis
Prototype
AjBool ajFileIsEof (
const AjPFile file
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File |
AjBool | | RETURN | ajTrue if we already set end-of-file |
Input
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
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
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File object. |
AjBool | | RETURN | ajTrue if the file matches stderr. |
Input
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
Tests whether a file object is really stderr.
Synopsis
Prototype
AjBool ajFileIsStderr (
const AjPFile file
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File object. |
AjBool | | RETURN | ajTrue if the file matches stderr. |
Input
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
Tests whether a file object is really stdin.
Synopsis
Prototype
AjBool ajFileIsStdin (
const AjPFile file
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File object. |
AjBool | | RETURN | ajTrue if the file matches stdin. |
Input
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
Tests whether a file object is really stdout.
Synopsis
Prototype
AjBool ajFileIsStdout (
const AjPFile file
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File object. |
AjBool | | RETURN | ajTrue if the file matches stdout. |
Input
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
Functions: ajFileTrace
Writes debug messages to trace the contents of a file object.
Synopsis
Prototype
void ajFileTrace (
const AjPFile file
);
Type | Name | Read/Write | Description |
const AjPFile | file | Input | File. |
void | | RETURN | |
Input
Returns
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
Functions: ajFileExit
Prints a summary of file usage with debug calls
Synopsis
Prototype
void ajFileExit (
void
);
Type | Name | Read/Write | Description |
void | | RETURN | |
Returns
Description
Prints a summary of file usage with debug calls
See Also
See other functions in this section
Availability
In release 6.4.0
Buffered file object
Sections: Buffered File Constructors Buffered File Destructors file reopen Buffered File Modifiers Buffered File Content Modifiers Buffered File Operators file debug
Functions: ajFilebuffNewFromCfile ajFilebuffNewFromFile ajFilebuffNewLine ajFilebuffNewListinList ajFilebuffNewNameS ajFilebuffNewNamePathC ajFilebuffNewNamePathS ajFilebuffNewNofile ajFilebuffNewPathWild ajFilebuffNewPathWildExclude
Creates a new buffered input file from an already open C file.
Synopsis
Prototype
AjPFilebuff ajFilebuffNewFromCfile (
FILE* file
);
Type | Name | Read/Write | Description |
FILE* | file | Modify | Open C file. |
AjPFilebuff | | RETURN | New 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
Creates a new buffered input file object from an open file.
Synopsis
Prototype
AjPFilebuff ajFilebuffNewFromFile (
AjPFile file
);
Type | Name | Read/Write | Description |
AjPFile | file | Modify | File object to be buffered. |
AjPFilebuff | | RETURN | New 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | line | Input | One line of buffered data. |
AjPFilebuff | | RETURN | New 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
Creates a new buffered file object from a list of filenames.
Synopsis
Prototype
AjPFilebuff ajFilebuffNewListinList (
AjPList list
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List of filenames as strings. |
AjPFilebuff | | RETURN | New 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
Creates a new buffered input file object with an opened named file.
Synopsis
Prototype
AjPFilebuff ajFilebuffNewNameS (
const AjPStr name
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
AjPFilebuff | | RETURN | New buffered file object. |
Input
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
Opens directory "dir", finds and opens file "name"
Synopsis
Prototype
AjPFilebuff ajFilebuffNewNamePathC (
const char* name,
const AjPStr path
);
Type | Name | Read/Write | Description |
const char* | name | Input | Filename. |
const AjPStr | path | Input | Directory. If empty uses current directory. |
AjPFilebuff | | RETURN | New 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
Opens directory "dir", finds and opens file "name"
Synopsis
Prototype
AjPFilebuff ajFilebuffNewNamePathS (
const AjPStr name,
const AjPStr path
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | Filename. |
const AjPStr | path | Input | Directory. If empty uses current directory. |
AjPFilebuff | | RETURN | New 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
Creates a new buffered input file object with an undefined file
to be used as a text buffer.
Synopsis
Prototype
AjPFilebuff ajFilebuffNewNofile (
void
);
Type | Name | Read/Write | Description |
AjPFilebuff | | RETURN | New 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory |
const AjPStr | wildname | Input | Wildcard filename. |
AjPFilebuff | | RETURN | New 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory |
const AjPStr | wildname | Input | Wildcard filename. |
const AjPStr | exclude | Input | Wildcard excluded filename. |
AjPFilebuff | | RETURN | New 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
Functions: ajFilebuffDel
Destructor for a buffered file object.
Synopsis
Prototype
void ajFilebuffDel (
AjPFilebuff* Pbuff
);
Type | Name | Read/Write | Description |
AjPFilebuff* | Pbuff | Delete | Buffered file object. |
void | | RETURN | |
Output
Pbuff: | (Delete) | Buffered file object. |
Returns
Description
Destructor for a buffered file object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: 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
);
Type | Name | Read/Write | Description |
AjPFilebuff* | Pbuff | Output | Buffered file object. |
AjPFile | file | Modify | File object to be buffered. |
AjBool | | RETURN | ajTrue on success |
Output
Pbuff: | (Output) | Buffered file object. |
Input & Output
file: | (Modify) | File object to be buffered. |
Returns
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
Functions: ajFilebuffClear ajFilebuffClearStore ajFilebuffFix ajFilebuffReset ajFilebuffResetPos ajFilebuffResetStore ajFilebuffSetBuffered ajFilebuffSetUnbuffered
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
ajint | lines | Input | Number of lines to retain. -1 deletes everything. |
void | | RETURN | |
Input
lines: | (Input) | Number of lines to retain. -1 deletes everything. |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
ajint | lines | Input | Number of lines to retain. -1 deletes everything. |
const AjPStr | lastline | Input | Last line of input.
Used to count characters to be saved |
AjBool | dostore | Input | append if true |
AjPStr* | Pstore | Output | Caller'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
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
void | | RETURN | |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
void | | RETURN | |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
void | | RETURN | |
Input & Output
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | File buffer |
AjBool | dostore | Input | True if text is stored |
AjPStr* | Pstore | Output | Stored 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
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file object. |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file object. |
AjBool | | RETURN | ajTrue 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
Functions: ajFilebuffHtmlNoheader ajFilebuffHtmlPre ajFilebuffHtmlStrip ajFilebuffLoadC ajFilebuffLoadS ajFilebuffLoadAll ajFilebuffLoadReadurl
Processes data in the file buffer, removing HTML titles and
decoding possible chunked input
Synopsis
Prototype
ajuint ajFilebuffHtmlNoheader (
AjPFilebuff buff
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file with data loaded
in the buffer. |
ajuint | | RETURN | HTTP error code |
Input & Output
buff: | (Modify) | Buffered file with data loaded
in the buffer. |
Returns
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
If we only have one pre-formatted section in HTML, that is all we keep.
Synopsis
Prototype
AjBool ajFilebuffHtmlPre (
AjPFilebuff buff
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | buffer |
AjBool | | RETURN | ajTrue=cleaned ajFalse=unchanged |
Input & Output
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file with data loaded
in the buffer. |
void | | RETURN | |
Input & Output
buff: | (Modify) | Buffered file with data loaded
in the buffer. |
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file. |
const char* | line | Input | Line of input. |
void | | RETURN | |
Input
line: | (Input) | Line of input. |
Input & Output
buff: | (Modify) | Buffered file. |
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file. |
const AjPStr | line | Input | Line of input. |
void | | RETURN | |
Input
line: | (Input) | Line of input. |
Input & Output
buff: | (Modify) | Buffered file. |
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file. |
void | | RETURN | |
Input & Output
buff: | (Modify) | Buffered file. |
Returns
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
Reads from a URL and loads all input lines into the buffer.
Synopsis
Prototype
AjBool ajFilebuffLoadReadurl (
AjPFilebuff buff,
const AjPStr url
);
Type | Name | Read/Write | Description |
AjPFilebuff | buff | Modify | Buffered file. |
const AjPStr | url | Input | URL |
AjBool | | RETURN | True on success |
Input
Input & Output
buff: | (Modify) | Buffered file. |
Returns
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
Functions: ajFilebuffGetFile ajFilebuffGetFileptr ajFilebuffGetFirst ajFilebuffIsBuffered ajFilebuffIsEmpty ajFilebuffIsEnded ajFilebuffIsEof
Returns the file object from a buffered file object.
Synopsis
Prototype
AjPFile ajFilebuffGetFile (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
AjPFile | | RETURN | File object. |
Input
buff: | (Input) | Buffered file. |
Returns
Description
Returns the file object from a buffered file object.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the C file pointer for an open buffered file.
Synopsis
Prototype
FILE* ajFilebuffGetFileptr (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
FILE* | | RETURN | C 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
Returns the first line of a file buffer
Synopsis
Prototype
const AjPStr ajFilebuffGetFirst (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | File buffer |
const AjPStr | | RETURN | First line |
Input
Returns
Description
Returns the first line of a file buffer
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether an input file is buffered.
Synopsis
Prototype
AjBool ajFilebuffIsBuffered (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file object. |
AjBool | | RETURN | ajTrue 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
Tests whether a file buffer is empty, including testing for a
possible next file
Synopsis
Prototype
AjBool ajFilebuffIsEmpty (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | File buffer |
AjBool | | RETURN | ajTrue if we already set end-of-file |
Input
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
Tests whether we have reached end of file already
Synopsis
Prototype
AjBool ajFilebuffIsEof (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | File buffer |
AjBool | | RETURN | ajTrue if we already set end-of-file |
Input
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
Functions: ajFilebuffTrace ajFilebuffTraceFull ajFilebuffTraceTitle
Writes debug messages to indicate the contents of a buffered file.
Synopsis
Prototype
void ajFilebuffTrace (
const AjPFilebuff buff
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
void | | RETURN | |
Input
buff: | (Input) | Buffered file. |
Returns
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
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
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
size_t | nlines | Input | Maximum number of lines to trace. |
size_t | nfree | Input | Maximum 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
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
Writes the full contents of a buffered file to the debug file
Synopsis
Prototype
void ajFilebuffTraceTitle (
const AjPFilebuff buff,
const char* title
);
Type | Name | Read/Write | Description |
const AjPFilebuff | buff | Input | Buffered file. |
const char* | title | Input | Report title |
void | | RETURN | |
Input
buff: | (Input) | Buffered file. |
title: | (Input) | Report title |
Returns
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
output file object
Sections: Outfile Constructors Outfile Destructors Outfile Casts
Functions: 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
);
Type | Name | Read/Write | Description |
const AjPStr | name | Input | File name. |
AjPOutfile | | RETURN | New output file object. |
Input
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
Functions: ajOutfileClose
Close and free an outfile object.
Synopsis
Prototype
void ajOutfileClose (
AjPOutfile* Pfile
);
Type | Name | Read/Write | Description |
AjPOutfile* | Pfile | Delete | Output file. |
void | | RETURN | |
Output
Pfile: | (Delete) | Output file. |
Returns
Description
Close and free an outfile object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajOutfileGetFile ajOutfileGetFileptr ajOutfileGetFormat ajOutfileGetFormatindex
Returns the AjPFile for an AjPOutfile object
Synopsis
Prototype
AjPFile ajOutfileGetFile (
const AjPOutfile file
);
Type | Name | Read/Write | Description |
const AjPOutfile | file | Input | Outfile object |
AjPFile | | RETURN | AjPFile object |
Input
file: | (Input) | Outfile object |
Returns
Description
Returns the AjPFile for an AjPOutfile object
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the C FILE* for an AjPOutfile object
Synopsis
Prototype
FILE* ajOutfileGetFileptr (
const AjPOutfile file
);
Type | Name | Read/Write | Description |
const AjPOutfile | file | Input | Outfile object |
FILE* | | RETURN | C file pointer |
Input
file: | (Input) | Outfile object |
Returns
Description
Returns the C FILE* for an AjPOutfile object
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the file format name for an AjPOutfile object
Synopsis
Prototype
const AjPStr ajOutfileGetFormat (
const AjPOutfile file
);
Type | Name | Read/Write | Description |
const AjPOutfile | file | Input | Outfile object |
const AjPStr | | RETURN | Format name |
Input
file: | (Input) | Outfile object |
Returns
Description
Returns the file format name for an AjPOutfile object
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the file format name for an AjPOutfile object
Synopsis
Prototype
ajuint ajOutfileGetFormatindex (
const AjPOutfile file
);
Type | Name | Read/Write | Description |
const AjPOutfile | file | Input | Outfile object |
ajuint | | RETURN | Format name |
Input
file: | (Input) | Outfile object |
Returns
Description
Returns the file format name for an AjPOutfile object
See Also
See other functions in this section
Availability
In release 6.4.0
Filename functions
Sections: Filename tests filename modifiers
Functions: ajFilenameExists ajFilenameExistsDir ajFilenameExistsExec ajFilenameExistsRead ajFilenameExistsWrite ajFilenameGetSize ajFilenameHasPath ajFilenameTestExclude ajFilenameTestExcludePath ajFilenameTestInclude ajFilenameTestIncludePath
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
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
AjBool | | RETURN | ajTrue on success |
Input
filename: | (Input) | Filename. |
Returns
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
Returns true if file exists and is a directory
Synopsis
Prototype
AjBool ajFilenameExistsDir (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
AjBool | | RETURN | ajTrue on success |
Input
filename: | (Input) | Filename. |
Returns
Description
Returns true if file exists and is a directory
See Also
See other functions in this section
Availability
In release 6.4.0
Returns true if file exists and is executable by the user
Synopsis
Prototype
AjBool ajFilenameExistsExec (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
AjBool | | RETURN | ajTrue on success |
Input
filename: | (Input) | Filename. |
Returns
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
Returns true if file exists and is readable by the user
Synopsis
Prototype
AjBool ajFilenameExistsRead (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
AjBool | | RETURN | ajTrue on success |
Input
filename: | (Input) | Filename. |
Returns
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
Returns true if file exists and is writable by the user
Synopsis
Prototype
AjBool ajFilenameExistsWrite (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
AjBool | | RETURN | ajTrue on success |
Input
filename: | (Input) | Filename. |
Returns
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
Returns the length of a file
Synopsis
Prototype
ajlong ajFilenameGetSize (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | Filename. |
ajlong | | RETURN | length 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
Tests whether a filename includes a directory specification.
Synopsis
Prototype
AjBool ajFilenameHasPath (
const AjPStr filename
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | File name. |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | File to test |
const AjPStr | exclude | Input | List of wildcard names to exclude |
const AjPStr | include | Input | List of wildcard names to include |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | File to test |
const AjPStr | exclude | Input | List of wildcard names to exclude |
const AjPStr | include | Input | List of wildcard names to include |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | File to test |
const AjPStr | exclude | Input | List of wildcard names to exclude |
const AjPStr | include | Input | List of wildcard names to include |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
const AjPStr | filename | Input | File to test |
const AjPStr | exclude | Input | List of wildcard names to exclude |
const AjPStr | include | Input | List of wildcard names to include |
AjBool | | RETURN | ajTrue 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
Functions: ajFilenameReplaceExtC ajFilenameReplaceExtS ajFilenameReplacePathC ajFilenameReplacePathS ajFilenameSetExtC ajFilenameSetExtS ajFilenameSetTempname ajFilenameSetTempnamePathC ajFilenameSetTempnamePathS ajFilenameTrimAll ajFilenameTrimExt ajFilenameTrimPath ajFilenameTrimPathExt
Replaces the extension part of a filename
Synopsis
Prototype
AjBool ajFilenameReplaceExtC (
AjPStr* Pfilename,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const char* | txt | Input | New file extension |
AjBool | | RETURN | ajTrue 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
Replaces the extension part of a filename
Synopsis
Prototype
AjBool ajFilenameReplaceExtS (
AjPStr* Pfilename,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const AjPStr | str | Input | New file extension |
AjBool | | RETURN | ajTrue 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
Sets the directory part of a filename
Synopsis
Prototype
AjBool ajFilenameReplacePathC (
AjPStr* Pfilename,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const char* | txt | Input | Directory |
AjBool | | RETURN | ajTrue if the replacement succeeded. |
Input
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
Sets the directory part of a filename
Synopsis
Prototype
AjBool ajFilenameReplacePathS (
AjPStr* Pfilename,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const AjPStr | str | Input | New directory |
AjBool | | RETURN | ajTrue if the replacement succeeded. |
Input
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
Sets the extension part of a filename
Synopsis
Prototype
AjBool ajFilenameSetExtC (
AjPStr* Pfilename,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const char* | txt | Input | New file extension |
AjBool | | RETURN | ajTrue 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
Sets the extension part of a base filename
Synopsis
Prototype
AjBool ajFilenameSetExtS (
AjPStr* Pfilename,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename. |
const AjPStr | str | Input | New file extension |
AjBool | | RETURN | ajTrue 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
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
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Output | Filename of new temporary file |
AjBool | | RETURN | True on success |
Output
Pfilename: | (Output) | Filename of new temporary file |
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Output | Filename of new temporary file |
const char* | txt | Input | Directory path |
AjBool | | RETURN | True on success |
Input
txt: | (Input) | Directory path |
Output
Pfilename: | (Output) | Filename of new temporary file |
Returns
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
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
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Output | Filename of new temporary file |
const AjPStr | str | Input | Directory path |
AjBool | | RETURN | True on success |
Input
str: | (Input) | Directory path |
Output
Pfilename: | (Output) | Filename of new temporary file |
Returns
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
Truncates a filename to a basic file name.
Synopsis
Prototype
AjBool ajFilenameTrimAll (
AjPStr* Pfilename
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | File name |
AjBool | | RETURN | ajTrue 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
Trims the extension (if any) from a filename
Synopsis
Prototype
AjBool ajFilenameTrimExt (
AjPStr* Pfilename
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename |
AjBool | | RETURN | ajTrue 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
Trims the directory path (if any) from a filename
Synopsis
Prototype
AjBool ajFilenameTrimPath (
AjPStr* Pfilename
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename |
AjBool | | RETURN | ajTrue 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
Trims the directory path (if any) and extension (if any) from a filename.
Synopsis
Prototype
AjBool ajFilenameTrimPathExt (
AjPStr* Pfilename
);
Type | Name | Read/Write | Description |
AjPStr* | Pfilename | Modify | Filename |
AjBool | | RETURN | ajTrue 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
Functions: ajDirnameFillPath ajDirnameFix ajDirnameFixExists ajDirnameUp
Checks that a string is a valid directory, and makes sure it has the
full path definition.
Synopsis
Prototype
AjBool ajDirnameFillPath (
AjPStr* Pdirname
);
Type | Name | Read/Write | Description |
AjPStr* | Pdirname | Modify | Directory path |
AjBool | | RETURN | true 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
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
);
Type | Name | Read/Write | Description |
AjPStr* | Pdirname | Modify | Directory name. |
void | | RETURN | |
Input & Output
Pdirname: | (Modify) | Directory name. |
Returns
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
Checks that a string is a valid existing directory, and appends a
trailing '/' if it is missing.
Synopsis
Prototype
AjBool ajDirnameFixExists (
AjPStr* Pdirname
);
Type | Name | Read/Write | Description |
AjPStr* | Pdirname | Modify | Directory path |
AjBool | | RETURN | true 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
Changes directory name to one level up
Synopsis
Prototype
AjBool ajDirnameUp (
AjPStr* Pdirname
);
Type | Name | Read/Write | Description |
AjPStr* | Pdirname | Modify | Directory name. |
AjBool | | RETURN | ajTrue 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
Functions: ajDirnamePrintRecursiveIgnore
Recursively scan through a directory, printing directory and file names
Synopsis
Prototype
void ajDirnamePrintRecursiveIgnore (
const AjPStr path,
AjPList ignorelist,
AjPFile outfile
);
Type | Name | Read/Write | Description |
const AjPStr | path | Input | Directory to scan |
AjPList | ignorelist | Modify | List of directories to ignore |
AjPFile | outfile | Modify | File 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
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
Lists of filenames
Sections: File list addition
Functions: ajFilelistAddDirectory ajFilelistAddListname ajFilelistAddPath ajFilelistAddPathDir ajFilelistAddPathWild ajFilelistAddPathWildDir ajFilelistAddPathWildRecursiveIgnore
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
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List for matching entries |
const AjPDir | dir | Input | Directory to scan |
ajint | | RETURN | number 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
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
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List of filenames |
const AjPStr | listname | Input | comma-separated filename list |
ajint | | RETURN | Number 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
Scan through a directory returning all filenames excluding directory names
Synopsis
Prototype
ajint ajFilelistAddPath (
AjPList list,
const AjPStr path
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List for matching entries |
const AjPStr | path | Input | Directory to scan |
ajint | | RETURN | number 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
Scan through a directory returning all filenames and directory names
except '.' and '..', including directories
Synopsis
Prototype
ajint ajFilelistAddPathDir (
AjPList list,
const AjPStr path
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List for matching entries |
const AjPStr | path | Input | Directory to scan |
ajint | | RETURN | number 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
Scan through a directory returning all filenames matching a
wildcard filename
Synopsis
Prototype
ajint ajFilelistAddPathWild (
AjPList list,
const AjPStr path,
const AjPStr wildname
);
Type | Name | Read/Write | Description |
AjPList | list | Output | List for matching entries |
const AjPStr | path | Input | Directory to scan |
const AjPStr | wildname | Input | Filename to search for |
ajint | | RETURN | number 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
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
);
Type | Name | Read/Write | Description |
AjPList | list | Output | List for matching entries |
const AjPStr | path | Input | Directory to scan |
const AjPStr | wildname | Input | Filename to search for |
ajint | | RETURN | number 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
Recursively scan through a directory
Synopsis
Prototype
ajint ajFilelistAddPathWildRecursiveIgnore (
AjPList list,
const AjPStr path,
const AjPStr wildname,
AjPList ignorelist
);
Type | Name | Read/Write | Description |
AjPList | list | Modify | List for matching filenames |
const AjPStr | path | Input | Directory to scan |
const AjPStr | wildname | Input | Filename to search for (or NULL) |
AjPList | ignorelist | Modify | List of directories to ignore |
ajint | | RETURN | number 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
File internal values
Sections: Values
Functions: ajFileValueBuffsize ajFileValueCwd ajFileValueRedirectStderr ajFileValueRedirectStdin ajFileValueRedirectStdout
Returns the default buffer size for a file
Synopsis
Prototype
ajuint ajFileValueBuffsize (
void
);
Type | Name | Read/Write | Description |
ajuint | | RETURN | Buffer 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
Returns the current directory
Synopsis
Prototype
const AjPStr ajFileValueCwd (
void
);
Type | Name | Read/Write | Description |
const AjPStr | | RETURN | Directory 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
Tests whether stderr is in use by an internal file
Synopsis
Prototype
AjBool ajFileValueRedirectStderr (
void
);
Type | Name | Read/Write | Description |
AjBool | | RETURN | ajTrue 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
Tests whether stdin is in use by an internal file
Synopsis
Prototype
AjBool ajFileValueRedirectStdin (
void
);
Type | Name | Read/Write | Description |
AjBool | | RETURN | ajTrue 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
Tests whether stdout is in use by an internal file
Synopsis
Prototype
AjBool ajFileValueRedirectStdout (
void
);
Type | Name | Read/Write | Description |
AjBool | | RETURN | ajTrue 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