Copyright (C) 1999, by Michael Van Canneyt

The FPC documentation is free text; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The FPC Documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with the FPC documentation; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --> `Various system utilities. This documentation describes the sysutils unit. The sysutils unit was started by Gertjan Schouten, and completed by Michael Van Canneyt. It aims to be compatible to the Delphi sysutils unit, but in contrast with the latter, it is designed to work on multiple platforms. It is implemented on all supported platforms. String functions

Functions for handling strings.

| Name | Description
| Compare two strings
| Compare two strings, case insensitive
| Removes quotes from string
| Get last character of string
| Convert string to all-lowercase
| Qoutes a string
| Compare strings case-sensitive
| Compare strings case-insensitive
| Compare L characters of strings case sensitive
| Compare L characters of strings case insensitive
| Get last character of string
| Convert string to all-lowercase
| Convert string to all-uppercase
| Convert string to all-uppercase
| Append 2 strings
| Assign value of strings on heap
| Compare two strings case sensitive
| Compare two strings case insensitive
| Remove string from heap
| Is string a valid pascal identifier
| Last occurance of character in a string
| Get first N characters of a string
| Load string from resources
| Convert string to all-lowercase
| Allocate new string on heap
| Get last N characters of a string
| Allocate memory for string
| Reserve memory for a string
| Remove string from heap
| Convert PChar to pascal string
| Copy pascal string
| Copy N bytes of pascal string
| Convert string to all-uppercase

Formatting strings

Functions for formatting strings.

| Name | Description
| Convert line breaks to line breaks for system
| Format a buffer
| Format arguments in string
| Format buffer
| Quote a string
| Format arguments in a string
| Format maximum L characters in a string
| Remove whitespace at the left of a string
| Remove whitespace at the right of a string
| Remove whitespace at both ends of a string

Date and time formatting characters

Various date and time formatting routines accept a format string. to format the date and or time. The following characters can be used to control the date and time formatting:

c
  shortdateformat + ' ' + shorttimeformat
d
  day of month
dd
  day of month (leading zero)
ddd
  day of week (abbreviation)
dddd
  day of week (full)
ddddd
  shortdateformat
dddddd
  longdateformat
m
  month
mm
  month (leading zero)
mmm
  month (abbreviation)
mmmm
  month (full)
y
  year (2 digits)
yy
  year (two digits)
yyyy
  year (with century)
h
  hour
hh
  hour (leading zero)
n
  minute
nn
  minute (leading zero)
s
  second
ss
  second (leading zero)
t
  shorttimeformat
tt
  longtimeformat
am/pm
  use 12 hour clock and display am and pm accordingly
a/p
  use 12 hour clock and display a and p accordingly
/
  insert date seperator
:
  insert time seperator
"xx"
  literal text
'xx'
  literal text
z
  milliseconds

PChar related functions

Most PChar functions are the same as their counterparts in the STRINGS unit. The following functions are the same :

1. : Concatenates two PChar strings.
2. : Compares two PChar strings.
3. : Copies a PChar string.
4. : Copies a PChar string and returns a pointer to the terminating null byte.
5. : Returns a pointer to the terminating null byte.
6. : Case insensitive compare of 2 PChar strings.
7. : Appends at most L characters from one PChar to another PChar.
8. : Case sensitive compare of at most L characters of 2 PChar strings.
9. : Copies at most L characters from one PChar to another.
10. : Returns the length (exclusive terminating null byte) of a PChar string.
11. : Case insensitive compare of at most L characters of 2 PChar strings.
12. : Converts a PChar to all lowercase letters.
13. : Moves one PChar to another.
14. : Makes a copy of a PChar on the heap, and returns a pointer to this copy.
15. : Returns the position of one PChar string in another?
16. : returns a pointer to the last occurrence of on PChar string in another one.
17. : returns a pointer to the first occurrence of on PChar string in another one.
18. : Converts a PChar to all uppercase letters.

The subsequent functions are different from their counterparts in STRINGS, although the same examples can be used.

File input/output routines

Functions for reading/writing to file.

| Name | Description
| Create a file and return handle
| Open file end return handle
| Read from file
| Set file position
| Truncate file length
| Write to file
| Close file handle

FileName handling routines

Functions for file manipulation.

| Name | Description
| Add sisk to list of disk drives
| Change extension of file name
| Create a directory
| Delete a file
| Free space on disk
| Total size of disk
| Create full file name
| Create full UNC file name
| Extract drive and directory part of filename
| Extract drive part of filename
| Extract extension part of filename
| Extract name part of filename
| Extrct path part of filename
| Construct relative path between two files
| Return file age
| Convert file date to system date
| Determine whether a file exists on disk
| Get attributes of file
| Get date of last file modification
| Search for file in path
| Get file attributes
| Get file dates
| Start finding a file
| Find next file
| Return current working directory
| Remove a directory from disk
| Rename a file on disk
| Set current working directory
| Set directory separator characters
| Stop searching a file
| Replace directory separator characters

Date/time routines

Functions for date and time handling.

| Name | Description
| Convert DateTime type to file date
| Construct string representation of DateTime
| Construct string representation of DateTime
| Convert DateTime to system time
| Convert DateTime to timestamp
| Construct string representation of date
| Get current date
| Get day of week
| Decode DateTime to year month and day
| Decode DateTime to hours, minutes and seconds
| Encode year, day and month to DateTime
| Encode hours, minutes and seconds to DateTime
| Return string representation of DateTime
| Add 1 to month
| Determine if year is leap year
| Convert nr of milliseconds to timestamp
| Get current date and time
| Convert string to DateTime
| Convert string to date
| Convert string to time
| Convert system time to datetime
| Convert time stamp to DateTime
| Convert Timestamp to number of millicseconds
| return string representation of Time
| Get current tyme

Miscellaneous conversion routines

Functions for various conversions.

| Name | Description
| Convert BCD number to integer
| Compare two memory regions
| Convert float to formatted string
| Convert float to string
| Convert float to string
| Format a floating point value
| Split string in list of directories
| return hexadecimal representation of integer
| return decumal representation of integer
| Convert string to integer with default value
| Convert string to integer
| Convert string to float
| Convert null-terminated string to float

Localization support

Localization support depends on various constants and structures being initialized correctly. On Windows and OS/2 this is done automatically: a widestring manager is installed by default which helps taking care of the current locale when performing various operations on strings. The various internationalization settings (date/time format, currency, language etc) are also initialized correctly on these platforms.

On unixes, the widestring support is in a separate unit: cwstring, which loads the various needed functions from the C library. It should be added manually to the uses clause of your program. No initialization settings are applied by this unit, these must be initialized separately for the moment.

Type describing date/time

Many functions return or require a TDateTime type, which contains a date and time in encoded form. The date and time are converted to a double as follows:

- The date part is stored in the integer part of the double as the number of days passed since January 1, 1900.
- The time part is stored in the fractional part of the double, as the number of milliseconds passed since midnight (00:00), divided by the total number of milliseconds in a day.

Return the current date. Date returns the current date in TDateTime format. None. Convert a TDateTime value to a file age (integer) DateTimeToFileDate function converts a date/time indication in TDateTime format to a filedate function, such as returned for instance by the function. None. , Converts a TDateTime value to a string using a predefined format. DateTimeToStr returns a string representation of DateTime using the formatting specified in LongDateTimeFormat. It corresponds to a call to FormatDateTime('c',DateTime) (see ). None. Converts a TDateTime value to a string with a given format. DateTimeToString returns in Result a string representation of DateTime using the formatting specified in FormatStr. for a list of characters that can be used in the FormatStr formatting string, see . In case a wrong formatting character is found, an EConvertError is raised. . Converts a TDateTime value to a systemtime structure. DateTimeToSystemTime converts a date/time pair in DateTime, with TDateTime format to a system time SystemTime. None. , Converts a TDateTime value to a TimeStamp structure. DateTimeToSystemTime converts a date/time pair in DateTime, with TDateTime format to a TTimeStamp format. None. , Converts a TDateTime value to a date string with a predefined format. DateToStr converts Date to a string representation. It uses ShortDateFormat as it's formatting string. It is hence completely equivalent to a FormatDateTime('ddddd', Date). None. , Returns the day of the week. DayOfWeek returns the day of the week from DateTime. Sunday is counted as day 1, Saturday is counted as day 7. The result of DayOfWeek can serve as an index to the LongDayNames constant array, to retrieve the name of the day. None. Decode a TDateTime to a year,month,day triplet DecodeDate decodes the Year, Month and Day stored in Date, and returns them in the Year, Month and Day variables. None. . Decode a TDateTime to a hour,minute,second,millisec quartet DecodeDate decodes the hours, minutes, second and milliseconds stored in Time, and returns them in the Hour, Minute and Second and MilliSecond variables. None. . Encode a Year,Month,Day to a TDateTime value.

EncodeDate encodes the Year, Month and Day variables to a date in TDateTime format. It does the opposite of the procedure.

The parameters must lie withing valid ranges (boundaries included):

Year
  must be between 1 and 9999.
Month
  must be within the range 1-12.
Day
  msut be between 1 and 31.

In case one of the parameters is out of it's valid range, an exception is raised. Encode a Hour,Min,Sec,millisec to a TDateTime value.

EncodeTime encodes the Hour, Minute, Second, MilliSecond variables to a TDateTime format result. It does the opposite of the procedure.

The parameters must have a valid range (boundaries included):

Hour
  must be between 0 and 23.
Minute,second
  must both be between 0 and 59.
Millisecond
  must be between 0 and 999.

In case one of the parameters is out of it's valid range, an exception is raised. Convert a FileDate value to a TDateTime value. FileDateToDateTime converts the date/time encoded in filedate to a TDateTime encoded form. It can be used to convert date/time values returned by the or / functions to TDateTime form. None. Return a string representation of a TDateTime value with a given format. FormatDateTime formats the date and time encoded in DateTime according to the formatting given in FormatStr. The complete list of formatting characters can be found in . On error (such as an invalid character in the formatting string), and EConvertError exception is raised. Increases the month in a TDateTime value with a given amount. IncMonth increases the month number in DateTime with NumberOfMonths. It wraps the result as to get a month between 1 and 12, and updates the year accordingly. NumberOfMonths can be negative, and can be larger than 12 (in absolute value). None. Determine whether a year is a leap year. IsLeapYear returns True if Year is a leap year, False otherwise. None. Convert a number of milliseconds to a TDateTime value.

MSecsTiTimeStamp converts the given number of milliseconds to a TTimeStamp date/time notation.

Use TTimeStamp variables if you need to keep very precise track of time.

None. Returns the current date and time. Now returns the current date and time. It is equivalent to Date+Time. None. Convert a date string to a TDateTime value.

StrToDate converts the string S to a TDateTime date value. The Date must consist of 1 to three digits, separated by the DateSeparator character. If two numbers are given, they are supposed to form the day and month of the current year. If only one number is given, it is supposed to represent the day of the current month. (This is not supported in Delphi)

The order of the digits (y/m/d, m/d/y, d/m/y) is determined from the ShortDateFormat variable.

On error (e.g. an invalid date or invalid character), an EConvertError exception is raised. Convert a date/time string to a TDateTime value.

StrToDateTime converts the string S to a TDateTime date and time value. The date and time parts must be separated by a space.

For the date part, the same restrictions apply as for the function: The Date must consist of 1 to three numbers, separated by the DateSeparator character. If two numbers are given, they are supposed to form the day and month of the current year. If only one number is given, it is supposed to represent the day of the current month. (This is not supported in Delphi)

The order of the 3 numbers (y/m/d, m/d/y, d/m/y) is determined from the ShortDateFormat variable.

On error (e.g. an invalid date or invalid character), an EConvertError exception is raised. Convert a time string to a TDateTime value. StrToTime converts the string S to a TDateTime time value. The time must consist of 1 to 4 digits, separated by the TimeSeparator character. If two numbers are given, they are supposed to form the hour and minutes. On error (e.g. an invalid date or invalid character), an EConvertError exception is raised. Convert a system time to a TDateTime value. SystemTimeToDateTime converts a TSystemTime record to a TDateTime style date/time indication. None. Returns the current time. Time returns the current time in TDateTime format. The date part of the TDateTimeValue is set to zero. None. Convert a TimeStamp value to a TDateTime value. TimeStampToDateTime converts TimeStamp to a TDateTime format variable. It is the inverse operation of . None. Converts a timestamp to a number of milliseconds.

TimeStampToMSecs converts TimeStamp to the number of seconds since 1/1/0001.

Use TTimeStamp variables if you need to keep very precise track of time.

For an example, see .

None. Convert a TDateTime time to a string using a predefined format. TimeToStr converts the time in Time to a string. It uses the ShortTimeFormat variable to see what formatting needs to be applied. It is therefor entirely equivalent to a FormatDateTime('t',Time) call. None. Add a disk to the list of known disks (Unix only)

On Unix-like platforms both the and functions need a file on the specified drive, since is required for the statfs system call.

These filenames are set in drivestr[0..26], and the first 4 have been preset to :

Disk 0
  '.'
  default drive - hence current directory is used.
Disk 1
  '/fd0/.'
  floppy drive 1.
Disk 2
  '/fd1/.'
  floppy drive 2.
Disk 3
  '/'
  C:
  equivalent of DOS is the root partition.

Drives 4..26 can be set by your own applications with the AddDisk call.

The AddDisk call adds Path to the names of drive files, and returns the number of the disk that corresponds to this drive. If you add more than 21 drives, the count is wrapped to 4.

None. Create a new directory

CreateDir creates a new directory with name NewDir. If the directory doesn't contain an absolute path, then the directory is created below the current working directory.

The function returns True if the directory was successfully created, False otherwise.

In case of an error, the function returns False. Return the amount of free diskspace

DiskFree returns the free space (in bytes) on disk Drive. Drive is the number of the disk drive:

0
  for the current drive.
1
  for the first floppy drive.
2
  for the second floppy drive.
3
  for the first hard-disk partition.
4-26
  for all other drives and partitions.

Under Linux, and Unix in general, the concept of disk is different than the dos one, since the filesystem is seen as one big directory tree. For this reason, the DiskFree and functions must be mimicked using filenames that reside on the partitions. For more information, see . On error, -1 is returned. DiskSize Return the total amount of diskspace.

DiskSize returns the size (in bytes) of disk Drive. Drive is the number of the disk drive:

0
  for the current drive.
1
  for the first floppy drive.
2
  for the second floppy drive.
3
  for the first hard-disk parttion.
4-26
  for all other drives and partitions.

Under Linux, and Unix in general, the concept of disk is different than the dos one, since the filesystem is seen as one big directory tree. For this reason, the and DiskSize functions must be mimicked using filenames that reside on the partitions. For more information, see

For an example, see DiskFree.

On error, -1 is returned. Return the current working directory of the application. GetCurrentDir returns the current working directory. None. Remove a directory from the filesystem.

RemoveDir removes directory Dir from the disk. If the directory is not absolue, it is appended to the current working directory.

For an example, see .

In case of error (e.g. the directory isn't empty) the function returns False. If successful, True is returned. Set the current directory of the application. SetCurrentDir sets the current working directory of your program to NewDir. It returns True if the function was successfull, False otherwise. In case of error, False is returned. Change the extension of a filename.

ChangeFileExt changes the file extension in FileName to Extension. The extension Extension includes the starting . (dot). The previous extension of FileName are all characters after the last ., the . character included.

If FileName doesn't have an extension, Extension is just appended.

None. Delete a file from the filesystem. DeleteFile deletes file FileName from disk. The function returns True if the file was successfully removed, False otherwise. On error, False is returned. Convert known directory separators to the current directory separator. This function replaces all known directory separators in FileName to the directory separator character for the current system. The list of known separators is specified in the constant. None. Expand a relative filename to an absolute filename. ExpandFileName expands the filename to an absolute filename. It changes all directory separator characters to the one appropriate for the system first. None. , Expand a relative filename to an absolute UNC filename. ExpandUNCFileName runs on FileName and then attempts to replace the driveletter by the name of a shared disk. None. , Extract the drive and directory part of a filename. ExtractFileDir returns only the directory part of FileName, including a driveletter. The directory name has NO ending directory separator, in difference with . None. , Extract the drive part from a filename.

Extracts the drive letter from a filename. Note that some operating systems do not support drive letters.

For an example, see .

, Return the extension from a filename.

ExtractFileExt returns the extension (including the .(dot) character) of FileName.

For an example, see .

None. , Extract the filename part from a full path filename.

ExtractFileName returns the filename part from FileName. The filename consists of all characters after the last directory separator character ('/' or '\') or drive letter.

The full filename can always be reconstucted by concatenating the result of and ExtractFileName.

For an example, see .

None. , Extract the path from a filename.

ExtractFilePath returns the path part (including driveletter) from FileName. The path consists of all characters before the last directory separator character ('/' or '\'), including the directory separator itself. In case there is only a drive letter, that will be returned.

The full filename can always be reconstucted by concatenating the result of ExtractFilePath and .

For an example, see .

None. , Extract a relative path from a filename, given a base directory. ExtractRelativePath constructs a relative path to go from BaseName to DestName. If DestName is on another drive (Not on Unix-like platforms) then the whole Destname is returned. Note: This function does not exist in the Delphi unit. None. , , Return the timestamp of a file. FileAge returns the last modification time of file FileName. The FileDate format can be transformed to TDateTime format with the function. In case of errors, -1 is returned. Close a file handle.

FileClose closes the file handle Handle. After this call, attempting to read or write from the handle will result in an error.

For an example, see

None. , Create a new file and return a handle to it.

FileCreate creates a new file with name FileName on the disk and returns a file handle which can be used to read or write from the file with the and functions.

If a file with name FileName already existed on the disk, it is overwritten.

The optional Mode parameter only has an effect under unix, where it can be used to set the mode (read, write, execute, sticky bit, setgid and setuid flags) of the created file to the specified custom value. On other platfors, the Mode parameter is ignored.

If an error occurs (e.g. disk full or non-existent path), the function returns -1. , Check whether a file exists in the filesystem. FileExists returns True if a file with name FileName exists on the disk, False otherwise. None. Return attributes of a file.

FileGetAttr returns the attribute settings of file FileName. The attribute is a OR-ed combination of the following constants:

faReadOnly
  The file is read-only.
faHidden
  The file is hidden. (On unix, this means that the filename starts with a dot)
faSysFile
  The file is a system file (On unix, this means that the file is a character, block or FIFO file).
faVolumeId
  Volume Label. Not possible under unix.
faDirectory
  File is a directory.
faArchive
  file is an archive. Not possible on Unix

In case of error, -1 is returned. . Return the file time of an opened file. FileGetdate returns the filetime of the opened file with filehandle Handle. It is the same as , with this difference that FileAge only needs the file name, while FilegetDate needs an open file handle. On error, -1 is returned. Open an existing file and return a filehandle

FileOpen opens a file with name FileName with mode Mode. Mode can be one of the following constants:

fmOpenRead
fmOpenWrite
fmOpenReadWrite

Under Windows and Unix, the above mode can be or-ed with one of the following sharing/locking flags:

fmShareCompat
fmShareExclusive
fmShareDenyWrite
fmShareDenyRead
fmShareDenyNone

If the file has been successfully opened, it can be read from or written to (depending on the Mode parameter) with the and FileWrite functions.

Remark that you cannot open a file if it doesn't exist yet, i.e. it will not be created for you. If you want tp create a new file, or overwrite an old one, use the function.

There are some limitations to the sharing modes.

1. Sharing modes are only available on Unix and Windows platforms.
2. Unix only support sharing modes as of 2.4.0.
3. fmShareDenyRead only works under Windows at this time, and will always result in an error on Unix platforms because its file locking APIs do not support this concept.
4. File locking is advisory on Unix platforms. This means that the locks are only checked when a file is opened using a file locking mode. In other cases, existing locks are simply ignored. In particular, this means that fmShareDenyNone has no effect under Unix, because this can only be implemented as ``use no locking'' on those platforms. As a result, opening a file using this mode will always succeed under Unix as far as the locking is concerned, even if the file has already been opened using fmShareExclusive.
5. Under Solaris, closing a single file handle associated with a file will result in all locks on that file (even via other handles) being destroyed due to the behaviour of the underlying API (fcntl). Because of the same reason, on Solaris you cannot use fmShareDenyWrite in combination with fmOpenWrite, nor fmShareExclusive in combination with fmOpenRead although both work with fmOpenReadWrite.

For an example, see

On Error, -1 is returned. , Read data from a filehandle in a buffer.

FileRead reads Count bytes from file-handle Handle and stores them into Buffer. Buffer must be at least Count bytes long. No checking on this is performed, so be careful not to overwrite any memory. Handle must be the result of a call.

The function returns the number of bytes actually read, or -1 on error.

For an example, see

On error, -1 is returned. , Search for a file in a path. FileSearch looks for the file Name in DirList, where dirlist is a list of directories, separated by semicolons or colons. It returns the full filename of the first match found. On error, an empty string is returned. Set the current file position on a file handle.

FileSeek sets the file pointer on position Offset, starting from Origin. Origin can be one of the following values:

fsFromBeginning
  Offset
  is relative to the first byte of the file. This position is zero-based. i.e. the first byte is at offset 0.
fsFromCurrent
  Offset
  is relative to the current position.
fsFromEnd
  Offset
  is relative to the end of the file. This means that Offset can only be zero or negative in this case.

If successfull, the function returns the new file position, relative to the beginning of the file.

The abovementioned constants do not exist in Delphi. On error, -1 is returned. Set the attributes of a file.

FileSetAttr sets the attributes of FileName to Attr. If the function was successful, 0 is returned, -1 otherwise. Attr can be set to an OR-ed combination of the pre-defined faXXX constants.

This function is not implemented on Unixes.

On error, -1 is returned (always on Unixes). . Set the date of a file.

FileSetDate sets the file date of the open file with handle Handle or to Age, where Age is a DOS date-and-time stamp value.

Alternatively, the filename may be specified with the FileName argument. This variant of the call is mandatory on unices, since there is no OS support for setting a file timestamp based on a handle. (the handle may not be a real file at all).

The function returns zero if successfull.

On Unix, the handle variant always returns -1, since this is impossible to implement. On Windows and DOS, a negative error code is returned. Truncate an open file to a given size.

FileTruncate truncates the file with handle Handle to Size bytes. The file must have been opened for writing prior to this call. The function returns True is successful, False otherwise.

For an example, see .

On error, the function returns False. Write data from a buffer to a given filehandle.

FileWrite writes Count bytes from Buffer to the file with handle Handle. Prior to this call, the file must have been opened for writing. Buffer must be at least Count bytes large, or a memory access error may occur.

The function returns the number of bytes written, or -1 in case of an error.

For an example, see .

In case of error, -1 is returned. Close a find handle

FindClose ends a series of / calls, and frees any memory used by these calls. It is absolutely necessary to do this call, or huge memory losses may occur.

For an example, see .

None. Start a file search and return a findhandle

FindFirst looks for files that match the name (possibly with wildcards) in Path and extra attributes Attr. It then fills up the Rslt record with data gathered about the file. It returns 0 if a file matching the specified criteria is found, a nonzero value (-1 on Unix-like platforms) otherwise.

Attr is an or-ed combination of the following constants:

faReadOnly
  The file is read-only.
faHidden
  The file is hidden. (On unix, this means that the filename starts with a dot)
faSysFile
  The file is a system file (On unix, this means that the file is a character, block or FIFO file).
faVolumeId
  Drive volume Label. Not possible under unix.
faDirectory
  File is a directory.
faArchive
  file is an archive. Not possible on Unix

It is a common misconception that Attr specifies a set of attributes which must be matched in order for a file to be included in the list. This is not so: The value of Attr specifies additional attributes, this means that the returned files are either normal files or have an attribute which is present in Attr.

Specifically: specifying faDirectory as a value for Attr does not mean that only directories will be returned. Normal files and directories will be returned.

The Rslt record can be fed to subsequent calls to FindNext, in order to find other files matching the specifications.

A FindFirst call must always be followed by a FindClose call with the same Rslt record. Failure to do so will result in memory loss. On error the function returns -1 on Unix-like platforms, a nonzero error code on Windows. {FindCloseSys}, . Find the next entry in a findhandle.

FindNext finds a next occurrence of a search sequence initiated by FindFirst. If another record matching the criteria in Rslt is found, 0 is returned, a nonzero constant is returned otherwise.

The last FindNext call must always be followed by a FindClose call with the same Rslt record. Failure to do so will result in memory loss.

For an example, see

On error (no more file is found), a nonzero constant is returned. Return a list of directory names from a path. GetDirs splits DirName in a null-byte separated list of directory names, Dirs is an array of PChars, pointing to these directory names. The function returns the number of directories found, or -1 if none were found. DirName must contain only OSDirSeparator as Directory separator chars. None. Rename a file. RenameFile renames a file from OldName to NewName. The function returns True if successful, False otherwise. Remark: you cannot rename across disks or partitions. On Error, False is returned. Set the directory separators to the known directory separators. SetDirSeparators returns FileName with all possible DirSeparators replaced by OSDirSeparator. None. Allocate a null-terminated string on the heap.

StrAlloc reserves memory on the heap for a string with length Len, terminating #0 included, and returns a pointer to it.

Additionally, StrAlloc allocates 4 extra bytes to store the size of the allocated memory. Therefore this function is NOT compatible with the StrAlloc function of the Strings unit.

For an example, see .

None. StrAlloc Return the size of a null-terminated string allocated on the heap. StrBufSize returns the memory allocated for Str. This function ONLY gives the correct result if Str was allocated using StrAlloc. If no more memory is available, a runtime error occurs. StrAlloc Dispose of a null-terminated string on the heap.

StrDispose frees any memory allocated for Str. This function will only function correctly if Str has been allocated using StrAlloc from the SysUtils unit.

For an example, see .

If an invalid pointer is passed, or a pointer not allocated with StrAlloc, an error may occur. Copy an ansistring to a null-terminated string.

StrPCopy Converts the Ansistring in Source to a Null-terminated string, and copies it to Dest. Dest needs enough room to contain the string Source, i.e. Length(Source)+1 bytes.

No checking is performed to see whether Dest points to enough memory to contain Source. Copy a limited number of characters from an ansistring to a null-terminated string. StrPLCopy Converts maximally MaxLen characters of the Ansistring in Source to a Null-terminated string, and copies it to Dest. Dest needs enough room to contain the characters. No checking is performed to see whether Dest points to enough memory to contain L characters of Source. . Convert a null-terminated string to an ansistring.

Converts a null terminated string in Str to an Ansitring, and returns this string. This string is NOT truncated at 255 characters as is the

None. Convert possible line-endings to the currently valid line ending. AdjustLineBreaks will change all occurrences of #13 and #10 characters with the correct line-ending characters for the current platform. This is #13#10 on Windows and Dos. On Unix-like platforms, this is #10 and for Mac OS X it is #13. None. Compare 2 ansistrings, case sensitive, ignoring accents characters.

AnsiCompareStr compares two strings and returns the following result:

< 0
  if S1<S2.
0
  if S1=S2.
> 0
  if S1>S2.

The comparision takes into account Ansi characters, i.e. it takes care of strange accented characters. Contrary to , the comparision is case sensitive.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Compare 2 ansistrings, case insensitive, ignoring accents characters.

AnsiCompareText compares two strings and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

the comparision takes into account Ansi characters, i.e. it takes care of strange accented characters. Contrary to , the comparision is case insensitive.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Removes the first quoted string from a string. AnsiExtractQuotedStr returns the first quoted string in Src, and deletes the result from Src. The resulting string has with Quote characters removed from the beginning and end of the string (if they are present), and double Quote characters replaced by a single Quote characters. As such, it revereses the action of . None. Return a pointer to the last character of a string.

This function returns a pointer to the last character of S.

A widestring manager must be installed in order for this function to work correctly with various character sets. If none is installed, this function is the same as @S[Length[S]]. None. Return a lowercase version of a string.

AnsiLowerCase converts the string S to lowercase characters and returns the resulting string. It takes into account the operating system language settings when doing this, so spcial characters are converted correctly as well.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Return a quoted version of a string.

AnsiQuotedString quotes the string S and returns the result. This means that it puts the Quote character at both the beginning and end of the string and replaces any occurrence of Quote in S with 2 Quote characters. The action of AnsiQuotedString can be reversed by .

For an example, see

None. Compare two null-terminated strings. Case sensitive.

AnsiStrComp compares 2 PChar strings, and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

The comparision of the two strings is case-sensitive.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Compare two null-terminated strings. Case insensitive.

AnsiStrIComp compares 2 PChar strings, and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

The comparision of the two strings is case-insensitive.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Return a pointer to the last character of a string.

Return a pointer to the last character of the null-terminated string.

A widestring manager must be installed in order for this function to work correctly with various character sets. If none is installed, this function is the same as @S[Length[S]]. None. Compares a given number of characters of a string, case insensitive.

AnsiStrLIComp compares the first Maxlen characters of 2 PChar strings, S1 and S2, and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

The comparision of the two strings is case-insensitive.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Convert a null-terminated string to all-lowercase characters.

AnsiStrLower converts the PChar Str to lowercase characters and returns the resulting pchar. Note that Str itself is modified, not a copy, as in the case of . It takes into account the operating system language settings when doing this, so special characters are converted correctly as well.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Convert a null-terminated string to all-uppercase characters.

AnsiStrUpper converts the PChar Str to uppercase characters and returns the resulting string. Note that Str itself is modified, not a copy, as in the case of . It takes into account the operating system language settings when doing this, so special characters are converted correctly as well.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Return an uppercase version of a string, taking into account special characters.

AnsiUpperCase converts the string S to uppercase characters and returns the resulting string. It takes into account the operating system language settings when doing this, so special characters are converted correctly as well.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Append one ansistring to another.

AppendStr appends S to Dest.

This function is provided for Delphi compatibility only, since it is completely equivalent to Dest:=Dest+S.

None. Assigns an ansistring to a null-terminated string.

AssignStr allocates S to P. The old value of P is disposed of.

This function is provided for Delphi compatibility only. AnsiStrings are managed on the heap and should be preferred to the mechanism of dynamically allocated strings.

None. Convert a BCD coded integer to a normal integer. BCDToInt converts a BCD coded integer to a normal integer. None. Compare two memory areas.

CompareMem compares, byte by byte, 2 memory areas pointed to by P1 and P2, for a length of L bytes.

It returns the following values:

<0
  if at some position the byte at P1 is less than the byte at the same postion at P2.
0
  if all L bytes are the same.
>0
  if at some position the byte at P1 is greater than the byte at the same postion at P2.

Compare 2 ansistrings case-sensitively, ignoring special characters.

CompareStr compares two strings, S1 and S2, and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

The comparision of the two strings is case-sensitive. The function does not take internationalization settings into account, it simply compares ASCII values.

None. Compare two ansistrings case insensitive (assuming ASCII encoding).

CompareText compares two strings, S1 and S2, and returns the following result:

<0
  if S1<S2.
0
  if S1=S2.
>0
  if S1>S2.

The comparision is case-insensitive for ASCII characters, else case sensitive.

When the strings have a different length, and are equal up to the size of the shorter string, the result reflects the length difference of the string

None. Dispose an ansistring from the heap.

DisposeStr removes the dynamically allocated string S from the heap, and releases the occupied memory.

This function is provided for Delphi compatibility only. AnsiStrings are managed on the heap and should be preferred to the mechanism of dynamically allocated strings.

For an example, see .

None. Convert a float value to a string using a fixed format.

FloatToStr converts the floating point variable Value to a string representation. It will choose the shortest possible notation of the two following formats:

Fixed format
  will represent the string in fixed notation,
Decimal format
  will represent the string in scientific notation.

More information on these formats can be found in . FloatToStr is completely equivalent to the following call:

`FloatToStrF(Value, ffGeneral,15, 0);` None. Convert a float value to a string using a given format.

FloatToStrF converts the floating point number value to a string representation, according to the settings of the parameters Format, Precision and Digits.

The meaning of the Precision and Digits parameter depends on the Format parameter. The format is controlled mainly by the Format parameter. It can have one of the following values:

ffcurrency
  Money format. Value is converted to a string using the global variables CurrencyString, CurrencyFormat and NegCurrencyFormat. The Digits paramater specifies the number of digits following the decimal point and should be in the range -1 to 18. If Digits equals -1, CurrencyDecimals is assumed. The Precision parameter is ignored.
ffExponent
  Scientific format. Value is converted to a string using scientific notation: 1 digit before the decimal point, possibly preceded by a minus sign if Value is negative. The number of digits after the decimal point is controlled by Precision and must lie in the range 0 to 15.
ffFixed
  Fixed point format. Value is converted to a string using fixed point notation. The result is composed of all digits of the integer part of Value, preceded by a minus sign if Value is negative. Following the integer part is DecimalSeparator and then the fractional part of Value, rounded off to Digits numbers. If the number is too large then the result will be in scientific notation.
ffGeneral
  General number format. The argument is converted to a string using ffExponent or ffFixed format, depending on wich one gives the shortest string. There will be no trailing zeroes. If Value is less than 0.00001 or if the number of decimals left of the decimal point is larger than Precision then scientific notation is used, and Digits is the minimum number of digits in the exponent. Otherwise Digits is ignored.
ffnumber
  Is the same as ffFixed, except that thousand separators are inserted in the resultig string.

None. Return a string representation of a float, with a given format.

FloatToText converts the floating point variable Value to a string representation and stores it in Buffer. The conversion is governed by format, Precisison and Digits. more information on these parameters can be found in . Buffer should point to enough space to hold the result. No checking on this is performed.

The result is the number of characters that was copied in Buffer.

None. Format a string with given arguments. FmtStr calls with Fmt and Args as arguments, and stores the result in Res. For more information on how the resulting string is composed, see . In case of error, a EConvertError exception is raised. . Format a string with given arguments.

Format replaces all placeholders inFmt with the arguments passed in Args and returns the resulting string. A placeholder looks as follows:

`'%' [[Index]':'] ['-'] [Width] ['.' Precision] ArgType`

elements between single quotes must be typed as shown without the quotes, and elements between square brackets [ ] are optional. The meaning of the different elements is shown below:

'%'
  starts the placeholder. If you want to insert a literal % character, then you must insert two of them : %%.
Index ':'
  takes the Index-th element in the argument array as the element to insert. If index is omitted, then the zeroth argument is taken.
'-'
  tells Format to left-align the inserted text. The default behaviour is to right-align inserted text. This can only take effect if the Width element is also specified.
Width
  the inserted string must have at least have Width characters. If not, the inserted string will be padded with spaces. By default, the string is left-padded, resulting in a right-aligned string. This behaviour can be changed by the '-' character.
'.' Precision
  Indicates the precision to be used when converting the argument. The exact meaning of this parameter depends on ArgType.

The Index, Width and Precision parameters can be replaced by *, in which case their value will be read from the next element in the Args array. This value must be an integer, or an EConvertError exception will be raised.

The argument type is determined from ArgType. It can have one of the following values (case insensitive):

D
  Decimal format. The next argument in the Args array should be an integer. The argument is converted to a decimal string. If precision is specified, then the string will have at least Precision digits in it. If needed, the string is (left) padded with zeroes.
E

  Scientific format. The next argument in the Args array should be a Floating point value. The argument is converted to a decimal string using scientific notation, using , where the optional precision is used to specify the total number of decimals. (defalt a valueof 15 is used). The exponent is formatted using maximally 3 digits.

  In short, the E specifier formats it's argument as follows:

  `FloatToStrF(Argument,ffexponent,Precision,3)`
F

  Fixed point format. The next argument in the Args array should be a floating point value. The argument is converted to a decimal string, using fixed notation (see ). Precision indicates the number of digits following the decimal point.

  In short, the F specifier formats it's argument as follows:

  `FloatToStrF(Argument,ffFixed,ffixed,9999,Precision)`
G

  General number format. The next argument in the Args array should be a floating point value. The argument is converted to a decimal string using fixed point notation or scientific notation, depending on which gives the shortest result. Precision is used to determine the number of digits after the decimal point.

  In short, the G specifier formats it's argument as follows:

  `FloatToStrF(Argument,ffGeneral,Precision,3)`
M

  Currency format. the next argument in the var{Args} array must be a floating point value. The argument is converted to a decimal string using currency notation. This means that fixed-point notation is used, but that the currency symbol is appended. If precision is specified, then then it overrides the CurrencyDecimals global variable used in the

  In short, the M specifier formats it's argument as follows:

  `FloatToStrF(Argument,ffCurrency,9999,Precision)`
N
  Number format. This is the same as fixed point format, except that thousand separators are inserted in the resulting string.
P
  Pointer format. The next argument in the Args array must be a pointer (typed or untyped). The pointer value is converted to a string of length 8, representing the hexadecimal value of the pointer.
S
  String format. The next argument in the Args array must be a string. The argument is simply copied to the result string. If Precision is specified, then only Precision characters are copied to the result string.
U
  Unsigned decimal format. The next argument in the Args array should be an unsigned integer. The argument is converted to a decimal string. If precision is specified, then the string will have at least Precision digits in it. If needed, the string is (left) padded with zeroes.
X
  hexadecimal format. The next argument in the Args array must be an integer. The argument is converted to a hexadecimal string with just enough characters to contain the value of the integer. If Precision is specified then the resulting hexadecimal representation will have at least Precision characters in it (with a maximum value of 32).

In case of error, an EConversionError exception is raised. Possible errors are:

1. Errors in the format specifiers.
2. The next argument is not of the type needed by a specifier.
3. The number of arguments is not sufficient for all format specifiers.

Format a string with given arguments and store the result in a buffer. FormatBuf calls and stores the result in Buf. Format a float according to a certain mask.

FormatFloat formats the floating-point value given by Value using the format specifications in Format. The format specifier can give format specifications for positive, negative or zero values (separated by a semicolon).

If the formatspecifier is empty or the value needs more than 18 digits to be correctly represented, the result is formatted with a call to with the ffGeneral format option.

The following format specifiers are supported:

0
  is a digit place holder. If there is a corresponding digit in the value being formatted, then it replaces the 0. If not, the 0 is left as-is.
#
  is also a digit place holder. If there is a corresponding digit in the value being formatted, then it replaces the #. If not, it is removed. by a space.
.
  determines the location of the decimal point. Only the first '.' character is taken into account. If the value contains digits after the decimal point, then it is replaced by the value of the DecimalSeparator character.
,
  determines the use of the thousand separator character in the output string. If the format string contains one or more ',' charactes, then thousand separators will be used. The ThousandSeparator character is used.
E+
  determines the use of scientific notation. If 'E+' or 'E-' (or their lowercase counterparts) are present then scientific notation is used. The number of digits in the output string is determined by the number of 0 characters after the 'E+'
;
  This character separates sections for positive, negative, and zero numbers in the format string.

If an error occurs, an exception is raised. Convert an integer value to a hexadecimal string. IntToHex converts Value to a hexadecimal string representation. The result will contain at least Digits characters. If Digits is less than the needed number of characters, the string will NOT be truncated. If Digits is larger than the needed number of characters, the result is padded with zeroes. None. , StrToInt Convert an integer value to a decimal string. IntToStr coverts Value to it's string representation. The resulting string has only as much characters as needed to represent the value. If the value is negative a minus sign is prepended to the string. None. Check whether a string is a valid identifier name. IsValidIdent returns True if Ident can be used as a compoent name. It returns False otherwise. Ident must consist of a letter or underscore, followed by a combination of letters, numbers or underscores to be a valid identifier. None. Return the last occurrence of a set of delimiters in a string. LastDelimiter returns the last occurrence of any character in the set Delimiters in the string S. Return a number of characters starting at the left of a string. LeftStr returns the Count leftmost characters of S. It is equivalent to a call to Copy(S,1,Count). None. Load a string from the resource tables. This function is not yet implemented. resources are not yet supported. Return a lowercase version of a string. LowerCase returns the lowercase equivalent of S. Ansi characters are not taken into account, only ASCII codes below 127 are converted. It is completely equivalent to the lowercase function of the system unit, and is provided for compatiibility only. None. Allocate a new ansistring on the heap.

NewStr assigns a new dynamic string on the heap, copies S into it, and returns a pointer to the newly assigned string.

This function is obsolete, and shouldn't be used any more. The AnsiString mechanism also allocates ansistrings on the heap, and should be preferred over this mechanism.

For an example, see .

If not enough memory is present, an EOutOfMemory exception will be raised. Return a quotes version of a string. QuotedStr returns the string S, quoted with single quotes. This means that S is enclosed in single quotes, and every single quote in S is doubled. It is equivalent to a call to AnsiQuotedStr(s, ''''). None. . Return a number of characters from a string, starting at the end.

RightStr returns the Count rightmost characters of S. It is equivalent to a call to Copy(S,Length(S)+1-Count,Count).

If Count is larger than the actual length of S only the real length will be used.

None. Format a string with given arguments, store the result in a buffer. StrFmt will format fmt with Args, as the function does, and it will store the result in Buffer. The function returns Buffer. Buffer should point to enough space to contain the whole result. for a list of errors, see . Format a string with given arguments, but with limited length. StrLFmt will format fmt with Args, as the function does, and it will store maximally Maxlen characters of the result in Buffer. The function returns Buffer. Buffer should point to enough space to contain MaxLen characters. for a list of errors, see . Convert a string to a floating-point value.

StrToFloat converts the string S to a floating point value. S should contain a valid string representation of a floating point value (either in decimal or scientific notation). The thousandseparator character may however not be used.

Up to and including version 2.2.2 of the compiler, if the string contains a decimal value, then the decimal separator character can either be a '.' or the value of the DecimalSeparator variable.

As of version 2.3.1, the string may contain only the DecimalSeparator character. The dot ('.') can no longer be used instead of the DecimalSeparator.

If the string S doesn't contain a valid floating point string, then an exception will be raised. Convert a string to an integer value.

StrToInt will convert the string Sto an integer. If the string contains invalid characters or has an invalid format, then an EConvertError is raised.

To be successfully converted, a string can contain a combination of numerical characters, possibly preceded by a minus sign (-). Spaces are not allowed.

In case of error, an EConvertError is raised. Convert a string to an integer value, with a default value.

StrToIntDef will convert a string to an integer. If the string contains invalid characters or has an invalid format, then Default is returned.

To be successfully converted, a string can contain a combination of numerical characters, possibly preceded by a minus sign (-). Spaces are not allowed.

None. Convert a buffer to a float value.

TextToFloat converts the string in Buffer to a floating point value. Buffer should contain a valid stroing representation of a floating point value (either in decimal or scientific notation). If the buffer contains a decimal value, then the decimal separator character can either be a '.' or the value of the DecimalSeparator variable.

The function returns True if the conversion was successful.

If there is an invalid character in the buffer, then the function returns False Trim whitespace from the ends of a string.

Trim strips blank characters (spaces) at the beginning and end of S and returns the resulting string. Only #32 characters are stripped.

If the string contains only spaces, an empty string is returned.

None. Trim whitespace from the beginning of a string. TrimLeft strips blank characters (spaces) at the beginning of S and returns the resulting string. Only #32 characters are stripped. If the string contains only spaces, an empty string is returned. None. Trim whitespace from the end of a string. Trim strips blank characters (spaces) at the end of S and returns the resulting string. Only #32 characters are stripped. If the string contains only spaces, an empty string is returned. None. Return an uppercase version of a string. UpperCase returns the uppercase equivalent of S. Ansi characters are not taken into account, only ASCII codes below 127 are converted. It is completely equivalent to the UpCase function of the system unit, and is provided for compatiibility only. None. Unix unit. Error descriptions. Error and other message strings. Return the last code from the OS.

GetLastOSError returns the error code from the last operating system call. It does not reset this code. In general, it should be called when an operating system call reported an error condition. In that case, GetLastOSError gives extended information about the error.

No assumptions should be made about the resetting of the error code by subsequent OS calls. This may be platform dependent.

Raise an exception with the last Operating System error code. RaiseLastOSError raises an exception with the error code returned by GetLastOSError. If the Error code is nonzero, then the corresponding error message will be returned. If the error code is zero, a standard message will be returned. This procedure may not be implemented on all platforms. If it is not, then a normal will be raised. Return the value of an environment variable.

GetEnvironmentVariable returns the value of the EnvVar environment variable. If the specified variable does not exist or EnvVar is empty, an empty string is returned.

Return the number of variables in the environment.

GetEnvironmentVariableCount returns the number of variables in the environment. The number is 1 based, but the result may be zero if there are no environment variables.

If there is no environment, -1 may be returned. Return an environment variable by index.

GetEnvironmentString returns the Index-th environment variable. The index is 1 based, and is bounded from above by the result of .

For an example, .

Note that on Windows, environment strings can start with an equal sign (=). This is a trick used to pass the current working directory to a newly created proces. In this case, extracting the variable name as the characters before the first equal sign will result in an empty name. If there is no environment, an empty string is returned. Suspend execution of a program for a certain time.

Sleep suspends the execution of the program for the specified number of milliseconds (milliseconds). After the specified period has expired, program execution resumes.

The indicated time is not exact, i.e. it is a minimum time. No guarantees are made as to the exact duration of the suspension. Execute another process (program). ExecuteProcess will execute the program in Path, passing it the arguments in ComLine. ExecuteProcess will then wait for the program to finish, and will return the exit code of the executed program. In case ComLine is a single string, it will be split out in an array of strings, taking into account common whitespace and quote rules. In case the program could not be executed or an other error occurs, an exception will be raised. Return the appropriate directory for the application's configuration files.

GetAppConfigDir returns the name of a directory in which the application should store its configuration files on the current OS. If the parameter Global is True then the directory returned is a global directory, i.e. valid for all users on the system. If the parameter Global is false, then the directory is specific for the user who is executing the program. On systems that do not support multi-user environments, these two directories may be the same.

The directory which is returned is the name of the directory where the application is supposed to store files. This does not mean that the directory exists, or that the user can write in this directory (especially if Global=True). It just returns the name of the appropriate location. Also note that the returned name does not contain a ending path delimiter.

On systems where the operating system provides a call to determine this location, this call will be used. On systems where there is no such call, an algorithm is used which reflects common practice on that system.

The application name is deduced from the binary name via the call, but can be configured by means of the callback.

None. Return an appropriate name for an application configuration file.

GetAppConfigFile returns the name of a file in which the application can store its configuration parameters. The Global parameter determines whether it is a global configuration file (value True) or a personal configuration file (value False). The parameter SubDir, in case it is set to True, will insert the name of a directory before the filename. This can be used in case the application needs to store other data than configuration data in an application-specific directory. Default behaviour is to set this to False. The default file extension of the returned file is: .cfg

No assumptions should be made about the existence or writeability of this file, or the directory where the file should reside.

On systems where the operating system provides a call to determine the location of configuration files, this call will be used. On systems where there is no such call, an algorithm is used which reflects common practice on that system.

The application name is deduced from the binary name via the call, but can be configured by means of the callback.

None. Return a default application name

ApplicationName returns the name of the current application. Standard this is equal to the result of ParamStr(0), but it can be customized by setting the callback.

Note that the returned value is only the name portion. It does not contain any path or file extension.

None. Default application configuration file extension. ConfigExtension is the default extension used by the call. It can be set to any valid extension for the current OS. System configuration directory.

SysConfigDir is the default system configuration directory. It is set at application startup by the sysutils initialization routines.

This directory may be returned by the call on some systems.

Callback type to get customized application name. This callback type is used by the to return an alternative application name. Callback to get a customized application name.

By default, the configuration file routines and use a default application name to construct a directory or filename. This callback can be used to provide an alternative application name.

Since the result of this callback will be used to construct a filename, care should be taken that the returned name does not contain directory separator characters or characters that cannot appear in a filename.

Pointer to TDayTable type. Array of day names. Number of hours in a day. Number of minutes per hour. Number of seconds per minute Number of milliseconds per second Number of minutes per day. Number of seconds per day Number of milliseconds per day Days between 1/1/0001 and 12/31/1899 Number of days between 1.1.1900 and 1.1.1970 Array with number of days in the months for leap and non-leap years. Window to determine what century 2 digit years are in. System time structure The System time structure contains the date/time in a human-understandable format. Year part Month part Day of month part Hour of the day Minute of the hour Second of the minute Milliseconds in the second TimeStamp structure TTimeStamp contains a timestamp, with the date and time parts specified as separate TDateTime values. Time part Date part Try to encode a date, and indicate success. TryEncodeDate will check the validity of the Year, Month and Day arguments, and if they are all valid, then they will be encoded as a TDateTime value and returned in D. The function will return True in this case. If an inbvalid argument is passed, then False will be returned. None. If an error occurs during the encoding, False is returned. Try to encode a time, and indicate success. TryEncodeTime will check the validity of the Hour, Min, Sec and MSec arguments, and will encode them in a TDateTime value which is returned in T. If the arguments are valid, then True is returned, otherwise False is returned. None. If an error occurs during the encoding, False is returned. Decode a date with additional date of the week. DecodeDateFully, like , decodes DateTime in its parts and returns these in Year, Month, Day but in addition returns the day of the week in DOW. None. Get the local time. GetLocalTime returns the system time in a format. None. Pointer to a ansistring Formats for the FloatToText function. TFloatFormat is used to determine how a float value should be formatted in the function. General number format. Scientific format. Fixed point format. Fixed point format with thousand separatord Monetary format. Type of float to return in the buffer for TextToFloat. TFloatValue determines which kind of value should be returned in the (untyped) buffer used by the function. Extended value Currency value Single value Real value Double value Comp value Flags for StringReplace function TReplaceFlags determines the behaviour of the function. . Replace all occurrences of the search string with the replacement string. Search case insensitive. Record descriing a float value TFloatRec is used to descibe a floating point value by the function. Exponent part Sign part Digits of fraction Minimum TDateTime value. Maximum TDateTime value. Minimum Currency value Maximum currency value Line break style TTextLineBreakStyle describes the style of linebreaks to be used in the function. Linefeed only Carriage-return only Carriage-return and linefeed characters Default line break style for the current platform. Lead bytes in Multi-Byte character sets LeadBytes contains the set of bytes that serve as lead byte in a MBCS string. Empty String Constant Pointer to an empty string Empty wide string. Compare 2 memory locations

CompareMemRange compares the 2 memory locations pointed to by P1 and P2 byte per byte. It stops comparing after Length bytes have been compared, or when it has encountered 2 different bytes. The result is then

>0
  if a byte in range P1 was found that is bigger than the corresponding byte in range P2.
0
  if all bytes in range P1 are the same as the corresponding bytes in range P2.
<0
  if a byte in range P1 was found that is less than the corresponding byte in range P2.

None. Checks whether 2 strings are the same (case insensitive) SameText calls with S1 and S2 as parameters and returns True if the result of that call is zero, or False otherwise. None. Checks whether 2 strings are the same (case insensitive) SameText calls with S1 and S2 as parameters and returns True if the result of that call is zero, or False otherwise. Checks whether 2 strings are the same (case sensitive)

SameText calls with S1 and S2 as parameters and returns True if the result of that call is zero, or False otherwise.

A widestring manager must be installed in order for this function to work correctly with various character sets. None. Compare a limited number of characters of 2 strings

AnsiStrLComp functions the same as , but compares at most MaxLen characters. If the first MaxLen characters in both strings are the same, then zero is returned.

Note that this function processes embedded null characters, treating them as a normal character.

None. Try to convert a string to an integer, and report on success. TryStrToInt tries to convert the string S to an integer, and returns True if this was succesful. In that case the converted integer is returned in I. If the conversion failed, (an invalid string, or the value is out of range) then False is returned. None. On error, False is returned. Convert a string to an Int64 value.

StrToInt64 converts the string S to a Int64 value, and returns this value. The string can only contain numerical characters, and optionally a minus sign as the first character. Whitespace is not allowed.

Hexadecimal values (starting with the $ character) are supported.

On error, a exception is raised. Try to convert a string to an int64 value, and report on success.

TryStrToInt64 tries to convert the string S to a Int64 value, and returns this value in I if successful. If the conversion was succesful, the function result is True, or False otherwise. The string can only contain numerical characters, and optionally a minus sign as the first character. Whitespace is not allowed.

Hexadecimal values (starting with the $ character) are supported.

None. On error, False is returned. Convert a string to an Int64 value, with a default value StrToInt64Def tries to convert the string S to a Int64 value, and returns this value. If the conversion fails for some reason, the value Default is returned instead. None. On error, the Default value is returned. Convert a string to a float, with a default value. StrToFloatDef tries to convert the string S to a floating point value, and returns this value. If the conversion fails for some reason, the value Default is returned instead. None. On error, the Default value is returned. Convert a float to a TDateTime value. FloatToDateTime converts the Value floating point value to a TDateTime value. It checks whether Value is in the valid range of dates (determined by and ). If not, an exception is raised. If Value is out of range, an exception is raised. Convert a float to a Currency value. FloatToCurr converts the Value floating point value to a Currency value. It checks whether Value is in the valid range of currencies (determined by and ). If not, an exception is raised. If Value is out of range, an exception is raised. Try to convert a float value to a currency value and report on success. TryFloatToCurr tries convert the Value floating point value to a Currency value. If successful, the function returns True and the resulting currency value is returned in AResult. It checks whether Value is in the valid range of currencies (determined by and ). If not, False is returned. If Value is out of range, False is returned. Convert a currency value to a string.

CurrToStr will convert a currency value to a string with a maximum of 15 digits, and precision 2. Calling CurrToStr is equivalent to calling :

`FloatToStrF(Value,ffNumber,15,2);` None. Convert a string to a currency value StrToCurr converts a string to a currency value and returns the value. The string should contain a valid currency amount, without currency symbol. If the conversion fails, an exception is raised. On error, an exception is raised. Convert a string to a currency value, using a default value StrToCurrDef converts a string to a currency value and returns the value. The string should contain a valid currency amount, without currency symbol. If the conversion fails, the fallback Default value is returned. On error, the Default value is returned. Convert a string to a boolean value StrToBool will convert the string S to a boolean value. The string S can contain one of 'True', 'False' (case is ignored) or a numerical value. If it contains a numerical value, 0 is converted to False, all other values result in True. If the string S contains no valid boolean, then an exception is raised. On error, an exception is raised. Convert a boolean value to a string. BoolToStr converts the boolean B to one of the strings 'TRUE' or 'FALSE' None. Replace occurrences of one substring with another in a string. StringReplace searches the string S for occurrences of the string OldPattern and, if it is found, replaces it with NewPattern. It returns the resulting string. The behaviour of StringReplace can be runed with Flags, which is of type . Standard behaviour is to replace only the first occurrence of OldPattern, and to search case sensitively. None. Convert a float value to a string using a given mask.

FloatToTextFmt returns a textual representation of Value in the memory location pointed to by Buffer. it uses the formatting specification in Format to do this. The return value is the number of characters that were written in the buffer.

For a list of valid formatting characters, see

No length checking is performed on the buffer. The buffer should point to enough memory to hold the complete string. If this is not the case, an access violation may occur. Convert a float value to a TFloatRec value. FloatToDecimal converts the float Value to a float description in the Result format. It will store Precision digits in the Digits field, of which at most Decimal decimals. None. Check whether a given string is a delimiter character. IsDelimiter checks whether the Index-th character in the string S is a delimiter character as passed in Delimiters. If Index is out of range, False is returned. None. Type of multi-byte character set. Single bytes Uses lead-byte Uses trailing byte Return the type of byte in an ansistring for a multi-byte character set ByteType returns the type of byte in the ansistring S at (1-based) position Index. No checking on the index is performed. Return the type of byte in a null-terminated string for a multi-byte character set StrByteType returns the type of byte in the null-terminated string Str at (0-based) position Index. No checking on the index is performed. Convert a length in bytes to a length in characters. ByteToCharLen returns the number of bytes in S, but limits the result to MaxLen This function does not take into account MBCS yet. Convert a length in characters to a length in bytes. CharToByteLen returns the number of bytes in S, but limits the result to MaxLen This function does not take into account MBCS yet. Convert a character index in Bytes to an Index in characters ByteToCharIndex returns the index (in characters) of the Index-th byte in S. This function does not take into account MBCS yet. Characters which start a command-line switch The characters in this set will be used by the function to determine whether a command-line argument is a switch (an option) or a value. If the first character of an argument is in SwitchChars, it will be considered an option or switch. Set of characters. Generic set of characters type. Check whether a certain switch is present on the command-line. FindCmdLineSwitch will check all command-line arguments for the presence of the option Switch. It will return True if it was found, False otherwise. Characters that appear in Chars (default is ) are assumed to indicate an option (switch). If the parameter IgnoreCase is True, case will be ignored when looking for the switch. Default is to search case sensitive. None. File Handle type. THandle refers to the definition of THandle in the system unit, and is provided for backward compatibility only. Procedural type TProcedure is a general definition of a procedural callback. Filename type TFileName is used in the definition. Set with size of integer. TIntegerSet is a generic integer subrange set definition whose size fits in a single integer. Record describing a longint value LongRec can be used to extract the parts of an long Integer: the high and low word, or the 4 separate bytes as a zero-based array of bytes. Note that the meaning of High and Low parts are different on various CPUs. Record describing a word value. LongRec can be used to extract the parts of a word: the high and low byte. Note that the meaning of the High and Low parts are different on various CPUs. Low byte of the word. High byte of the word Record describing an Int64 value Int64Rec can be used to extract the parts of a Int64: the high and low cardinal, or a zero-based array of 4 words, or a zero based array of 8 bytes. Note that the meaning of the High and Low parts are different on various CPUs. Pointer to an array of byte. Generic pointer to . Use to access memory regions as a byte array. Array of bytes TByteArray is a generic array definition, mostly for use as a base type of the type. Pointer to an array of word. Generic pointer to . Use to access memory regions as a word array. TWordArray is a generic array definition, mostly for use as a base type of the type. Base class of all exceptions. Exception is the base class for all exception handling routines in the RTL and FCL. While it is possible to raise an exception with any class descending from TObject, it is recommended to use Exception as the basis of exception class objects: the Exception class introduces properties to associate a message and a help context with the exception being raised. What is more, the SysUtils unit sets the necessary hooks to catch and display unhandled exceptions: in such cases, the message displayed to the end user, will be the message stored in the exception class. Constructs a new exception object with a given message. Create allocates a new exception object on the heap, and stores Msg in the Message property. Construction may fail if there is not enough memory on the heap. Constructs a new exception object and formats a new message.

CreateFmt allocates a new exception object on the heap, and fills the Message property with the result of a call to with Msg and Args as arguments.

Using CreateFmt is equivalent to using the following code:

`Exception.Create(Format(Msg,Args));` Construction may fail if there is not enough memory on the heap. Constructs a new exception object and gets the message from a resource.

CreateRes allocates a new exception object on the heap, and stores fetches the resource string ResString from the resources and stores it in the Message property.

Resources are not yet implemented in Free Pascal. Construction may fail if there is not enough memory on the heap. Constructs a new exception object and formats the message from a reasource. CreateResFmt does the same as CreateFmt, but fetches the message from the resource string ResString. Construction may fail if there is not enough memory on the heap. Constructs a new exception object and sets the help context. CreateHelp does the same as the Create constructor, but additionally stores AHelpContext in the HelpContext property. Constructs a new exception object and sets the help context and formats the message CreateFmtHelp does the same as the CreateFmt constructor, but additionally stores AHelpContext in the HelpContext property. Constructs a new exception object and sets the help context and gets the message from a resource CreateResHelp does the same as the CreateRes constructor, but additionally stores AHelpContext in the HelpContext property. Constructs a new exception object and sets the help context and formats the message from a resource CreateResFmtHelp does the same as the CreateResFmt constructor, but additionally stores AHelpContext in the HelpContext property. Help context associated with the exception. HelpContext is the help context associated with the exception, and can be used to provide context-sensitive help when the exception error message is displayed. It should be set in the exception constructor. Message associated with the exception. Message provides additional information about the exception. It is shown to the user in e.g. the routine, and should be set in the constructor when the exception is raised. Exception Class reference ExceptClass is a class reference. External Exception. EExternal is the base exception for all external exceptions, as reported by the CPU or operating system, as opposed to internal exceptions, which are raised by the program itself. The SysUtils unit converts all operating system errors to descendents of EExternal. Integer operation error. EInterror is used when the operating system or CPU signals an integer operation error, e.g., an overflow. Division by zero error. EDivByZero is used when the operating system or CPU signals a division by zero error. Range check error. ERangeError is raised by the Free Pascal runtime library if range checking is on, and a range check error occurs. Integer overflow error. EIntOverflow is used when the operating system or CPU signals a integer overflow error. Mathematical error EMathError is used when the operating system or CPU signals a floating point overflow error. Invalid operation. EInvalidOp is raised when an invalid operation is encountered. Division by zero error. EZeroDivide occurs when a float division by zero occurs. Float overflow error. EOverflow occurs when a float operation overflows. (i.e. result is too big to represent). Float underflow error EOverflow occurs when a float operation underflows (i.e. result is too small to represent). Input/Output error EInOutError is raised when a IO routine of Free Pascal returns an error. The error is converted to an EInOutError only if the input/output checking feature of FPC is turned on. The error code of the input/output operation is returned in ErrorCode. Error code for Input/Output operation. ErrorCode contains the error code from the I/O operation which raised the exception. An explanation of the error codes can be found in the user's manual. Heap memory error EHeapMemoryError is raised when an error occurs in heap (dynamically allocated) memory. Heap exception EHeapMemoryError is raised when an error occurs in the heap management routines. External exception EExternalException is raised when an external routine raises an exception. Invalid pointer operation EInvalidPointer is raised when an invalid heap pointer is used. Out of memory error. EOutOfMemory occurs when memory can no longer be allocated on the heap. An instance of EOutOfMemory is allocated on the heap at program startup, so it is available when needed. Invalid typecast error. EInvalidCast is raised when an invalid typecast error (using the as operator) is encountered. Variant error. EVariantError is raised by the internal variant routines. Variant error code. ErrCode is the error code describing the actual error. Create an instance of EVariantError with a particular error code. CreateCode calls the inherited constructor, and sets the ErrCode property to Code. ErrCode Access Violation error EAccessViolation is raised when the OS reports an Access Violation, i.e. when invalid memory is accessed. Privileged instruction error. EPrivilege is raised when the OS reports that an invalid instruction was executed. Stack overflow error. EStackOverflow occurs when the stack has grown too big (e.g. by infinite recursion). Control-C (abort) was pressed on the console. EControlC is raised when the user has pressed CTRL-C in a console application. Conversion error. EConvertError is raised by the various conversion routines in the SysUtils unit. The message will contain more specific error information. Abort error. Abort is raised by the procedure. It is not displayed in GUI applications, and serves only to immediatly abort the current procedure, and return control to the main program loop. Abstract error. EAbstractError is raised when an abstract error occurs, i.e. when an unimplemented abstract method is called. Assertion failed error. EAssertionFailed is raised when an application that is compiled with assertions, encounters an invalid assertion. Read-only property error. EPropReadOnly is raised when an attempt is made to write to a read-only property. Write-only property error. EPropWriteOnly is raised when an attempt is made to read from a write-only property. Invalid interface cast error. EIntfCastError is raised when an invalid interface cast is encountered. Invalid container error. EInvalidContainer is not yet used by Free Pascal, and is provided for Delphi compatibility only. Invalid insert error. EInvalidInsert is not yet used by Free Pascal, and is provided for Delphi compatibility only. Package error. EPackageError is not yet used by Free Pascal, and is provided for Delphi compatibility only. Operating system error. EOSError is raised when some Operating System call fails. The ErrorCode property contains the operating system error code. Operating system error code. ErrorCode contains the error code reported by the operating system for the call which caused the to be raised. SafeCall exception. ESafecallException is not yet used by Free Pascal, and is provided for Delphi compatibility only. No Thread support error. ENoThreadSupport is raised when some thread routines are invoked, and thread support was not enabled when the program was compiled. Current Exception object. ExceptObject returns the currently treated exception object when an exception is raised, and the stack is unwound. If there is no exception, the function returns Nil Current exception address. ExceptAddr returns the address from the currently treated exception object when an exception is raised, and the stack is unwound. Return a message describing the exception.

ExceptionErrorMessage creates a string that describes the exception object ExceptObject at address ExceptAddr. It can be used to display exception messages. The string will be stored in the memory pointed to by Buffer, and will at most have Size characters.

The routine checks whether ExceptObject is a object or not, and adapts the output accordingly.

Show the current exception to the user.

ShowException shows a message stating that a ExceptObject was raised at address ExceptAddr. It uses to create the message, and is aware of the fact whether the application is a console application or a GUI application. For a console application, the message is written to standard error output. For a GUI application, is executed.

If, for a GUI application, is not set, no message will be displayed to the user.

The exception message can be at most 255 characters long: It is possible that no memory can be allocated on the heap, so ansistrings are not available, so a shortstring is used to display the message.

Abort program execution. Abort raises an exception. Raise an EOutOfMemory exception OutOfMemoryError raises an exception, with an exception object that has been allocated on the heap at program startup. The program should neved create an exception, but always call this routine. Sound the system bell. Beep sounds the system bell, if one is available. This routine may not be implemented on all platforms. Format a system error message. SysErrorMessage returns a string that describes the operating system error code ErrorCode. This routine may not be implemented on all platforms. Terminate procedure procedural variable. TTerminateProc is the procedural type which should be used when adding exit procedures. Add a procedure to the exit chain. AddTerminateProc adds TermProc to the list of exit procedures. When the program exits, the list of exit procedures is run over, and all procedures are called one by one, in the reverse order that they were added to the exit chain. If no memory is available on the heap, an exception may be raised. Call the exit chain procedures. CallTerminateProcs is run on program exit. It executes all terminate procedures that were added to the exit chain with , and does this in reverse order. If one of the exit procedure raises an exception, it is not caught, and the remaining exit procedures will not be executed. Callback to show unhandled exceptions. OnShowException is the callback that uses to display a message in a GUI application. For GUI applications, this variable should always be set. Note that no memory may be available when this callback is called, so the callback should already have all resources it needs, when the callback is set. Length of filerec filename field. filerecnamelength describes the length of the filename field. Record describing an untyped file.

FileRec describes a untyped file. This record is made available so it can be used to implement drivers for other than the normal file system file records.

Operating system file handle. Current file mode. Record data size Private data. Do not use User data. Only use when implementing new type. File name Length of text file record filename field Buffer size of text file record. TextRecBufSize is the size of the default buffer in Text record buffer array type TextBuf is the type for the default buffer in Record describing a text file type

TextRec describes a text file. This record is made available so it can be used to implement drivers for other than the normal file system file records.

To implement a driver, an Assign procedure must be implemented, which fills in the various fields of the record. Most notably, the callback functions must be filled in appropriately. After this, the normal file operations will handle all necessary calls to the various callbacks.

Operating system handle for file. Open mode Size of buffer. Private data. Do not use. Current buffer position. Current buffer end. Pointer to current buffer. File open function. Allocates handle. Read/write function Flush buffer function Close handle function. User data for text rec. File name Default buffer. String to prepend to hexadecimal values HexDisplayPrefix is used by the formatting routines to indicate that the number which follows the prefix is in Hexadecimal notation. Currently unused in Free Pascal. Path (directory) delimiter. PathDelim refers to the system unit's DirectorySeparator constant, it is for Delphi compatibility only. Drive letter delimiter DriveDelim refers to the system unit's DriveSeparator constant, it is for Delphi compatibility only. Path separator. (Separates paths in search path lists) PathSep refers to the system unit's PathSeparator constant, it is for Delphi compatibility only. Record describing an untyped file. Alias for for Delphi compatibility. Record describing a text file. Alias for for Delphi compatibility. Type for case conversion tables. TCaseTranslationTable is the type for a lookup table that can convert 255 ascii characters. Table for conversion of characters to uppercase. UpperCaseTable is used by the routine (and friends) to convert a string to all-uppercase characters. It is filled with the appropriate entries by the SysUtils unit initialization routines. Table for conversion of characters to lowercase. LowerCaseTable is used by the routine (and friends) to convert a string to all-lowercase characters. It is filled with the appropriate entries by the SysUtils unit initialization routines. Date separator character (subject to locale). DateSeparator is the character used by various date/time conversion routines as the character that separates the day from the month and the month from the year in a date notation. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Short Date Format string (subject to locale). ShortDateFormat contains a template to format a date in a short format. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Long date format string (subject to locale). LongDateFormat contains a template to format a date in a long format. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Names of months, abbreviated form. ShortMonthNames is an array with the abbreviated names of months. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Full names of months. LongMonthNames is an array with the full names of months. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Names of days, abbreviated form. ShortDayNames is an array with the abbreviated names of days. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Full names of days. LongDayNames is an array with the full names of days. It is used by the date formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Short time format string (subject to locale). ShortTimeFormat contains a template to format a time in a short notation. It is used by the time formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Long time format string (subject to locale) LongTimeFormat contains a template to format a time in full notation. It is used by the time formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Time separator character. TimeSeparator is used by the time formatting routines to separate the hours from the minutes and the minutes from the seconds. It is used by the time formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. AM indicator string. TimeAMString is used to display the AM symbol in the time formatting routines. It is used by the time formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. PM indicator string. TimePMString is used to display the PM symbol in the time formatting routines. It is used by the time formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Decimal point separator. DecimalSeparator is used to display the decimal symbol in floating point numbers or currencies. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Thousand grouping character. ThousandSeparator is used to separate groups of thousands in floating point numbers or currencies. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Number of decimals in currency amounts. CurrencyDecimals is the number of decimals to be used when formatting a currency. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Format string for currencies. CurrencyFormat is the default format string for positive currencies. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Format string for negative currencies. CurrencyFormat is the default format string for negative currencies. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Name of currency. CurrencyString is the currency symbol for the current locale. It is used by the float formatting routines. The initialization routines of the SysUtils unit initialize this string with a value conforming to the regional preferences of the user or system regional default. Length of a null-terminated string. Returns the length of the null-terminated string P. None. Copy a null-terminated string Copy the null terminated string in Source to Dest, and returns a pointer to Dest. Dest needs enough room to contain Source, i.e. StrLen(Source)+1 bytes. No length checking is performed. Copy a null-terminated string, limited in length. Copies MaxLen characters from Source to Dest, and makes Dest a null terminated string. No length checking is performed. Copy a null-terminated string, return a pointer to the end. Copies the Null-terminated string in Source to Dest, and returns a pointer to the end (i.e. the terminating Null-character) of the copied string. No length checking is performed. Return a pointer to the end of a null-terminated string Returns a pointer to the end of P. (i.e. to the terminating null-character. None. Concatenate 2 null-terminated strings. Attaches Source to Dest and returns Dest. No length checking is performed. Compare 2 null-terminated strings, case sensitive.

Compares the null-terminated strings S1 and S2. The result is

- A negative Longint when S1<S2.
- 0 when S1=S2.
- A positive Longint when S1>S2.

For an example, see .

None. Compare limited number of characters of 2 null-terminated strings

Compares maximum L characters of the null-terminated strings S1 and S2. The result is

- A negative Longint when S1<S2.
- 0 when S1=S2.
- A positive Longint when S1>S2.

None. Compare 2 null-terminated strings, case insensitive.

Compares the null-terminated strings S1 and S2, ignoring case. The result is

- A negative Longint when S1<S2.
- 0 when S1=S2.
- A positive Longint when S1>S2.

None. Move a null-terminated string to new location. Copies MaxLen characters from Source to Dest. No terminating null-character is copied. Returns Dest None. Concatenate 2 null-terminated strings, with length boundary. Adds MaxLen characters from Source to Dest, and adds a terminating null-character. Returns Dest. None. Find first occurrence of a character in a null-terminated string. Returns a pointer to the first occurrence of the character C in the null-terminated string P. If C does not occur, returns Nil. None. Find last occurrence of a character in a null-terminated string.

Returns a pointer to the last occurrence of the character C in the null-terminated string P. If C does not occur, returns Nil.

For an example, see .

None. Convert null-terminated string to all-lowercase. Converts P to an all-lowercase string. Returns P. None. Convert null-terminated string to all-uppercase

Converts P to an all-uppercase string. Returns P.

For an example, see

None. Compare limited number of characters in 2 null-terminated strings, ignoring case.

Compares maximum L characters of the null-terminated strings S1 and S2, ignoring case. The result is

- A negative Longint when S1<S2.
- 0 when S1=S2.
- A positive Longint when S1>S2.

For an example, see

None. Find position of one null-terminated substring in another. Returns a pointer to the first occurrence of S2 in S1. If S2 does not occur in S1, returns Nil. None. Allocate room for new null-terminated string. Copies P to the Heap, and returns a pointer to the copy. Returns Nil if no memory was available for the copy. Compare 2 filenames.

AnsiCompareFileName compares 2 filenames S1 and S2, and returns

< 0
  if S1<S2.
= 0
  if S1=S2.
> 0
  if S1>S2.

The function actually checks FileNameCaseSensitive and returns the result of or depending on whether FileNameCaseSensitive is True or False

None. Convert filename to lowercase.

AnsiLowerCaseFileName simply returns the result of

`AnsiLowerCase(S);` Convert filename to uppercase.

AnsiUpperCaseFileName simply returns the result of

`AnsiUpperCase(S);` Return Position of one ansistring in another. AnsiPos does the same as the standard Pos function. Return position of one null-terminated substring in another AnsiStrPos returns a pointer to the first occurrence of SubStr in Str. If SubStr does not occur in Str then Nil is returned. An access violation may occur if either Str or SubStr point to invalid memory. Find last occurrence of a character in a null-terminated string. AnsiStrPos returns a pointer to the last occurrence of the character Chr in Str. If Chr does not occur in Str then Nil is returned. An access violation may occur if Str points to invalid memory. Find first occurrence of a character in a null-terminated string. AnsiStrPos returns a pointer to the first occurrence of the character Chr in Str. If Chr does not occur in Str then Nil is returned. An access violation may occur if Str points to invalid memory. Characters that are known directory separators. DirSeparators is a set of characters which are known directory separator characters on all supported platforms. This set is used by the call to correct pathnames for the current platform. Add trailing directory separator to a pathname, if needed.

IncludeTrailingPathDelimiter adds a trailing path delimiter character () to Path if none is present yet, and returns the result.

If Path is empty, a path delimiter is returned, for Delphi compatibility.

Add trailing directory separator to a pathname, if needed. IncludeTrailingBackslash is provided for backwards compatibility with Delphi. Use instead. Strip trailing directory separator from a pathname, if needed. ExcludeTrailingPathDelimiter removes the trailing path delimiter character () from Path if it is present, and returns the result. Strip trailing directory separator from a pathname, if needed. ExcludeTrailingBackslash is provided for backwards compatibility with Delphi. Use instead. Is the character at the given position a pathdelimiter ? IsPathDelimiter returns True if the character at position Index equals , i.e. if it is a path delimiter character for the current platform. Are two filenames referring to the same file ? SameFileName returns True if calling with arguments S1 and S2 returns 0, and returns False otherwise. None. Record describing a search handle or result

TSearchRec is a search handle description record. It is initialized by a call to and can be used to do subsequent calls to . It contains the result of these function calls. It must be used to close the search sequence with a call to .

Not all fields of this record should be used. Some of the fields are for internal use only. (PathOnly for example, is only provided for Kylix compatibility) Timestamp of the file. Size of the file. Attributes of the file. File name (no directory part) Attributes to exclude from search (do not use). Internal OS handle (do not use). For kylix compatibility, on Unices only (do not use). Read-Only file. Attribute of a file, meaning the file is read-only. Used in and Hidden file. Attribute of a file, meaning the file is hidden. On unix, this means the filename starts with a dot character. Attribute of a file, meaning the file is read-only. Used in and System file (Dos/Windows only) Attribute of a file, meaning the file is a system file. Used in and Volume id (Dos/Windows only) Attribute of a file, meaning the file contains the volume ID. Used in and File is a directory Attribute of a file, meaning the file is a directory. Used in and Archive bit is set Attribute of a file, meaning the file has the archive bit set. Used in and Match any file Use this attribute in the call to find all matching files. Open file in read-only mode fmOpenRead is used in the call to open a file in read-only mode. Open file in write-only mode fmOpenWrite is used in the call to open a file in write-only mode. Open file in read/write mode. fmOpenReadWrite is used in the call to open a file in read-write mode. Open file in DOS share-compatibility mode fmOpenShareCompat is used in the call OR-ed together with one of , or ,to open a file in a sharing modus that is equivalent to sharing implemented in MS-DOS. Lock file for exclusive use fmOpenShareExclusive is used in the call OR-ed together with one of , or , to open a file exclusively. Lock file so other processes can only read. fmOpenShareWrite is used in the call OR-ed together with one of , or , to open a file so other processes cannot write to it, they can only read. Lock file so other processes cannot read.

fmOpenShareRead is used in the call OR-ed together with one of , or , to open a file so other processes cannot read from it.

This constant only works on Windows, because other operating systems do not support this constants.

Do not lock file. fmOpenShareExclusive is used in the call OR-ed together with one of , or , to open a file so other processes can read/write the file as well. Start seek operation from beginning of file. fsFromBeginning is used to indicate in the call that a seek operation should be started at the start of the file. Start seek operation from current position in file. fsFromBeginning is used to indicate in the call that a seek operation should be started at the current position in the file. Start seek operation from end of file. fsFromBeginning is used to indicate in the call that a seek operation should be started at the last position in the file. Check whether a directory exists in the file system. DirectoryExists checks whether Directory exists in the filesystem and is actually a directory. If this is the case, the function returns True, otherwise False is returned. Check whether a file is read-only. FileIsReadOnly checks whether FileName exists in the filesystem and is a read-only file. If this is the case, the function returns True, otherwise False is returned. Extract OS handle from an untyped file or text file. GetFileHandle returns the operating system handle for the file descriptor F. It can be used in various file operations which are not directly supported by the pascal language. Thread-safe integer increment. InterlockedIncrement increments Target in a thread-safe way, and returns the new value of Target Thread-safe integer decrement InterlockedDecrement decrements Target in a thread-safe way, and returns the new value of Target Thread-safe exchange of 2 values. InterlockedDecrement replaces Target with Source in a thread-safe way, and returns the old value of Target Thread-safe exchange of 2 values InterlockedDecrement adds to Target the value of Source in a thread-safe way, and returns the old value of Target Free object if needed, and set object reference to Nil FreeAndNil will free the object in Obj and will set the reference in Obj to Nil. The reference is set to Nil first, so if an exception occurs in the destructor of the object, the reference will be Nil anyway. Exceptions that occur during the destruction of Obj are not caught. Return name of system's temporary directory

GetTempDir returns the temporary directory of the system. If Global is True (the default value) it returns the system temporary directory, if it is False then a directory private to the user is returned. The returned name will end with a directory delimiter character.

These directories may be the same. No guarantee is made that this directory exists or is writeable by the user.

The handler may be set to provide custom handling of this routine: One could implement callbacks which take into consideration frameworks like KDE or GNOME, and return a different value from the default system implementation.

On error, an empty string is returned. Return the name of a temporary file.

GetTempFileName returns the name of a temporary file in directory Dir. The name of the file starts with Prefix.

If Dir is empty, the value returned by GetTempDir is used, and if Prefix is empty, 'TMP' is used.

The handler may be set to provide custom handling of this routine: One could implement callbacks which take into consideration frameworks like KDE or GNOME, and return a different value from the default system implementation.

On error, an empty string is returned. Handler for GetTempDir function. OnGetTempDir can be used to provide custom behaviour for the function. Note that the returned name should have a trailing directory delimiter character. Handler for GetTempFileName function. OnGetTempDir can be used to provide custom behaviour for the function. Note that the values for Prefix and Dir should be observed. Function prototype for OnGetTempDir handler. Function prototype for OnGetTempFile handler. End-of-line string TLineEndStr is used in the record to indicate the end-of-line sequence for a text file. Type describing the current locale TSysLocale describes the current locale. If Fareast or MBCS is True, then the current locale uses a Multi-Byte Character Set. If MiddleEast or RightToLeft is True then words and sentences are read from right to left. Multi-Byte Character Set used Reading direction is Right-to-left Multi-Byte Character Set used Reading direction is Right-to-left Variable with locale information SysLocale is initialized by the initialization code of the SysUtils unit. For an explanation of the fields, see Create a chain of directories ForceDirectories tries to create any missing directories in Dir till the whole path in Dir exists. It returns True if Dir already existed or was created succesfully. If it failed to create any of the parts, False is returned. Return the length of a null-terminated string in characters. StrCharLength returns the length of the null-terminated string Str (a widestring) in characters (not in bytes). It uses the widestring manager to do this. Try to convert a string to a float. TryStrToFloat tries to convert the string S to a floating point value, and stores the result in Value. It returns True if the operation was succesful, and False if it failed. This operation takes into account the system settings for floating point representations. On error, False is returned. Compare two widestrings (case sensitive)

WideCompareStr compares two widestrings and returns the following result:

< 0
  if S1<S2.
0
  if S1=S2.
> 0
  if S1>S2.

The comparision takes into account wide characters, i.e. it takes care of strange accented characters. Contrary to , the comparision is case sensitive.

None. Compare two widestrings (ignoring case).

WideCompareStr compares two widestrings and returns the following result:

< 0
  if S1<S2.
0
  if S1=S2.
> 0
  if S1>S2.

The comparision takes into account wide characters, i.e. it takes care of strange accented characters. Contrary to , the comparision is case insensitive.

None. Format a wide string.

WideFormat does the same as but accepts as a formatting string a WideString. The resulting string is also a WideString.

For more information about the used formatting characters, see the string.

Change a widestring to all-lowercase.

WideLowerCase converts the string S to lowercase characters and returns the resulting string. It takes into account the operating system language settings when doing this, so spcial characters are converted correctly as well.

On Unix-like platforms, a widestring manager must be installed for this function to work correctly. None. Check whether two widestrings are the same (case sensitive) WideSameStr returns True if returns 0 (zero), i.e. when S1 and S2 are the same string (taking into account case). Check whether two widestrings are the same (ignoring case) WideSameText returns True if returns 0 (zero), i.e. when S1 and S2 are the same string (taking into account case). Change a widestring to all-lowercase.

WideUpperCase converts the string S to uppercase characters and returns the resulting string. It takes into account the operating system language settings when doing this, so spcial characters are converted correctly as well.

On Unix-like platforms, a widestring manager must be installed for this function to work correctly. None. Word-wrap a text. WrapText does a wordwrap at column MaxCol of the string in Line. It breaks the string only at characters which are in BreakChars (default whitespace and hyphen) and inserts then the string BreakStr (default the lineending character for the current OS). Format a currency

FormatCurr formats the currency Value according to the formatting rule in Format, and returns the resulting string.

For an explanation of the formatting characters, see .

Try to convert a string to a currency

TryStrToCurr converts the string S to a currency value and returns the value in Value. The function returns True if it was successful, False if not. This is contrary to , which raises an exception when the conversion fails.

The function takes into account locale information.

Widestring format WideFmtStr formats Args according to the format string in Fmt and returns the resulting string in Res. Format widestring in a buffer. WideFormatBuf calls simply with Fmt (with length FmtLen bytes) and stores maximum BufLen bytes in the buffer buf. It returns the number of copied bytes. Unix functionality Error descriptions Message Strings Unix functionality types Try to convert a string with a date indication to a TDateTime value

TryStrToDate tries to convert the string S to a TDateTime date value, and stores the date in Value. The Date must consist of 1 to three digits, separated by the DateSeparator character. If two numbers are given, they are supposed to form the day and month of the current year. If only one number is given, it is supposed to represent the day of the current month. (This is not supported in Delphi)

The order of the digits (y/m/d, m/d/y, d/m/y) is determined from the ShortDateFormat variable.

The function returns True if the string contained a valid date indication, False otherwise.

Try to convert a string with a time indication to a TDateTime value

TryStrToTime tries to convert the string S to a TDateTime time value, and stores the result in Value. The time must consist of 1 to 4 digits, separated by the TimeSeparator character. If two numbers are given, they are supposed to form the hour and minutes.

The function returns True if the string contained a valid time indication, False otherwise.

Try to convert a string with date/time indication to a TDateTime value

TryStrToDateTime tries to convert the string S to a TDateTime date and time value, and stores the result in Value. The date must consist of 1 to three digits, separated by the DateSeparator character. If two numbers are given, they are supposed to form the day and month of the current year. If only one number is given, it is supposed to represent the day of the current month (This is not supported in Delphi). The time must consist of 1 to 4 digits, separated by the TimeSeparator character. If two numbers are given, they are supposed to form the hour and minutes.

The function returns True if the string contained a valid date and time indication, False otherwise.

Return the current year CurrentYear returns the current year as a 4-digit number. None. Convert a string to a QWord. TryStrToQWord converts the string S to a valid QWord (unsigned 64-bit) value, and returns the result. If the string S does not contain a valid QWord value, a exception is raised. Try to convert a string to a QWord value, and report on success TryStrToQWord tries to convert the string S to a valid QWord (unsigned 64-bit) value, and stores the result in I. If the conversion fails, the function returns False, else it returns True. Alias for TryStrToQWord. TryStrToQWord is a backward-compatibility alias for . Try to convert a string to a QWord, returning a default value in case of failure. StrToQWordDef tries to convert the string S to a valid QWord (unsigned 64-bit) value, and returns the result. If the conversion fails, the function returns the value passed in Def. Format a currency to a string CurrToStrF formats the currency Value according to the value in Format, using the number of digits specified in Digits, and a precision of 19. This function simply calls . Scan a string for substrings and return the substrings

SSCanF scans the string S for the elements specified in Fmt, and returns the elements in the pointers in Pointers. The Fmt can contain placeholders of the form %X where X can be one of the following characters:

d
  Placeholder for a decimal number.
f
  Placeholder for a floating point number (an extended)
s
  Placeholder for a string of arbitrary length.
c
  Placeholder for a single character

The Pointers array contains a list of pointers, each pointer should point to a memory location of a type that corresponds to the type of placeholder in that position:

d
  A pointer to an integer.
f
  A pointer to an extended.
s
  A pointer to an ansistring.
c
  A pointer to a single character.

No error checking is performed on the type of the memory location. Pointer to TSysCharSet type. Lower byte Upper byte Array of 4 bytes. Lower integer High integer Array of 4 words Array of 8 bytes Bus error exception EBusError is raised in case of a bus error. Formatting error exception EformatError is raised in case of an error in one of the various functions. Number of frames included in an exception backtrace ExceptFrameCount returns the number of frames that are included in an exception stack frame backtrace. The function returns 0 if there is currently no exception being handled. (i.e. it only makes sense to call this function in an finally..end or except..end block. None. Callback prototype to create GUIDs TCreateGUIDFunc is the prototype for a GUID creation handler. On return, the GUID argument should contain a new (unique) GUID. The return value of the function should be zero for success, nonzero for failure. Callback to create GUID values OnCreateGUID can be set to point to a custom routine that creates GUID values. If set, the function will use it to obtain a GUID value. If it is not set, a default implementation using random values will be used to create the unique value. The function should return a valid GUID in the GUID parameter, and should return zero in case of success. Create a new GUID

CreateGUID can be called to create a new GUID (Globally Unique Identifier) value. The function returns the new GUID value in GUID and returns zero in case the GUID was created succesfully. If no GUID was created, a nonzero error code is returned.

The default mechanism for creating a new GUID is system dependent. If operating system support is available, it is used. If none is available, a default implementation using random numbers is used.

The OnCreateGUID callback can be set to hook a custom mechanism behind the CreateGUID function. This can be used to lt the GUID be created by an external GUID creation library.

On error, a nonzero return value is returned. Line ending used when writing to this text file. Maximum length of a fully qualified filename (including path) MAX_PATH is the maximum number of characters that a filename (including path) can contain on the current operating system. Separator character for lists ListSeparator is the character used in lists of values. It is locale dependent. Unix File mode. Only used on Unix systems. Path component of the file File is a symlink faSymLink means the file (as returned e.g. by /), is a symlink. It's ignored under Windows. FileOpen error value feInvalidHandle is the return value of in case of an error. Read/Write synchronizer IReadWriteSync is an interface for synchronizing read/write operations. Writers are always guaranteed to have exclusive access: readers may or may not have simultaneous access, depending on the implementation. Start a read operation.

BeginRead indicates that a read operation is about to be started. If a write operation is in progress, then the call will block untill the write operation finished. Depending on the implementation the call may also block if another read operation is in progress.

After BeginRead, any write operation started with BeginWrite will block until EndRead is called.

End a read operation EndRead signals the end of a read operation. If there was any blocked write operation, that will be unblocked by a call to EndRead. Start a write operation. BeginWrite signals the begin of a write operation. This call will block if any other read or write operation is currently in progress. It will resumt only after all other read or write operations have finished. End a write operation. EndWrite signals the end of a write operation. After the call to EndWrite any other read or write operations can start. Standard implementation of a IReadWriteSync interface TMultiReadExclusiveWriteSynchronizer is a default implementation of the interface. It uses a single mutex to protect access to the read/write resource, resulting in a single thread having access to the resource. Create a new instance of the TMultiReadExclusiveWriteSynchronizer class Create creates a new instance of TMultiReadExclusiveWriteSynchronizer. It initializes a TRTLCriticalSection. None. TRTLCriticalSection Destroys the TMultiReadExclusiveWriteSynchronizer instance Create destroys the instance of TMultiReadExclusiveWriteSynchronizer. It frees the TRTLCriticalSection it initialized, and calls the inherited destructor. None. TRTLCriticalSection Request write access to the resource. Beginwrite is the implementation of IReadWriteSync.BeginWrite. It simply enters the critical section, and returns True. None. EndWrite Release write access to the resource Beginwrite is the implementation of IReadWriteSync.EndWrite. It simply leaves the critical section. None. BeginWrite Request read access to the resource BeginRead is the implementation of IReadWriteSync.BeginRead. It simply attempts to enter the critical section. None. EndRead Release read access to the resource EndRead is the implementation of IReadWriteSync.EndRead. It simply leaves the critical section. None. BeginRead Check whether a class or given interface supports an interface Supports checks whether Instance supports the interface identified by IID. It returns True if it is supported, False. Optionally, a pointer to the interface is returned to Intf. None. Convert a string to a native TGUID type.

StringToGUID converts the string S to a valid GUID. The string S should be of the form

    {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

Where each X is a hexadecimal digit. The dashes and braces are required.

In case S contains an invalid GUID representation, a exception is raised. Convert a TGUID to a string representation.

GUIDToString converts the GUID identifier in GUID to a string representation in the form

    {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

Where each X is a hexadecimal digit.

None. Check whether two TGUID variables are equal. IsEqualGUID checks whether guid1 and guid2 are equal, and returns True if this is the case, or False otherwise. Load a library safely SafeLoadLibrary saves and restores some registers before and after issuing a call to LoadLibrary. None. INTERRUPT signal number (Unix only) Floating Point Error signal number (Unix only) Segmentation fault signal number (Unix only) Illegal instruction signal number (Unix only) Bus error signal number (Unix only) QUIT signal number (Unix only) Last signal number (Unix only) Default signal handler (Unix only) State of the signal handler (unix only) TSignalState indicates the state of a signal handler in a unix system for a particular signal. No signal handler is set for the signal. A signal handler is set by the RTL code for the signal. A signal handler was set for the signal by third-party code. Check whether a signal handler is set (unix only)

RtlSigNum will check whether the signal RtlSigNum is being handled, and by whom. It returns a TSignalState result to report the state of the signal, which can be one of the following values:

ssNotHooked
ssHooked
ssOverridden

This routine works by resetting the signal handlers, so it is risky to call.

Abandon the signal handler AbandonSignalHandler tells the system routines that they should not re-install the signal handler for signal RtlSigNum under any circumstances. Normally, signal handlers are re-set when they are called. If AbandonSignalHandler has been called for a signal that is handled by the system code, the signal will not be re-set again. Hook a specified signal HookSignal installs the RTL default signal handler for signal RtlSigNum. It does not check whether the signal is already handled, and should therefor only be called if InquireSignal returns ssNotHooked. UnHook a specified signal UnHookSignal de-installs the RTL default signal handler for signal RtlSigNum. If OnlyIfHooked is True then UnhookSignal will first check if the signal was hooked by the RTL routines, and has not been overridden since. Record with all the strings that determine formatting TFormatSettings is a record that contains a copy of all variables which determine formatting in the various string formatting routines. It is used to pass local copies of these values to the various formatting routines in a thread-safe way. Currency format string Negative currency format string Thousands separator character Decimal separator character Currency decimals Date separator character Time separator character List separator character Currency string Short date format string Long Date Format string AM time indicator string PM time indicator string Short time format string Long time format string Array with short month names Array with long month names Array with short day names Long day names Value for 2 digit year century window Unix calls (unix implementation only) Error descriptions Resource strings Basic unix types Add a date and time ComposeDateTime correctly adds Date and Time, also for dates before 1899-12-31. For dates after this date, it is just the mathematical addition. None. Default locale ID Primary language ID Sub-language ID Array type for array of month variables TMonthNameArray is used in the month long and short name arrays. TWeekNameArray is used in the day long and short name arrays. Storage for default settings

DefaultFormatSettings contains the default settings for all type of formatting constants. If no thread-specific values are specified when a formatting function is called, this record is used as a default.

All other formatting constants refer to the fields of this variable using absolute addressing.

Convert string to date, returning a default value StrToDateDef tries to convert the string S to a valid TDateTime date value, and returns DefValue if S does not contain a valid date indication. None. Convert string to time, returning a default value StrToTimeDef tries to convert the string S to a valid TDateTime time value, and returns DefValue if S does not contain a valid time indication. None. Convert string to date/time, returning a default value StrToDateTimeDef tries to convert the string S to a valid TDateTime date and time value, and returns DefValue if S does not contain a valid date-time indication. None. Replace the time part ReplaceTime replaces the time part in dati with NewTime. The date part remains untouched. True Strings used in StrToBool conversion TrueBoolStrs contains the strings that will result in a True return value by . False Strings used in StrToBool conversion FalseBoolStrs contains the strings that will result in a False return value by . Convert string to boolean value, returning default in case of error StrToBoolDef tries to convert the string S to a boolean value, and returns the boolean value in case of success. In case S does not contain a valid boolean string, Default is returned. Try to convert a string to a boolean value

TryStrToBool tries to convert the string S to a boolean value, and returns this value in Value. In this case, the function returns True. If S does not contain a valid boolean string, the function returns False, and the contents of Value is indetermined.

Valid boolean string constants are in the (for False values) and (for True values) variables.

Returns the application vendor name. VendorName returns the application vendor name. This function does not do anything by itself, but uses the callback to get the application vendor name. If is not set, an empty string is returned. Returns the current user's home directory.

GetUserDir returns the home directory of the current user. On Unix-like systems (that includes Mac OS X), this is the value of the HOME environment variable. On Windows, this is the PROFILE special folder. On all other platforms, the application installation directory is returned.

If non-empty, it contains a trailing path delimiter.

Prototype for OnGetVendorName event. TGetVendorNameEvent is the function prototype for the callback, used by the function. Callback for the VendorName function. OnGetVendorName is the callback used by the function. It should be set to a handler that returns the vendor of the application. Starting point of the Julian calendar Starting point of the unix calendar (1/1/1970) Increase a date with a certain amount of months

IncAMonth increases the date as specified by Year, Month, Day with NumberOfMonths. It takes care of the number of days in a month when calculating the result.

This function does the same as , but operates on an already decoded date.

Replace the date part of a date/time stamp ReplaceDate replaces the date part of DateTime with NewDate. The time part is left unchanged. Returns a pointer to the location of the next empty character in a null-terminated string StrNextChar returns a pointer to the null-character that terminates the string Str if Str is not properly terminated, an access violation may occur. Returns a 8.3 path name ExtractShortPathName returns a 8.3 compliant filename that represents the same file as FileName. On platforms other than windows, this is FileName itself. Return the name of the current module

GetModuleName returns the name of the current module. On windows, this is the name of the executable when executed in an executable, or the name of the library when executed in a library.

On all other platforms, the result is always empty, since they provide no such functionality.

Package is an executable Never-build flag was specified when compiling package Package is a design-time only package Package is a run-time only package Ignore duplicate units in package Package is a real package (not exe) Mask for module type flags Not used in Free Pascal. Not used in Free Pascal. Not used in Free Pascal. Not used in Free Pascal. Package is a library Mask for producer flags Unit is the main unit of the package Unit is a packaged unit (appeared in package contains list) Unit is a weak packaged unit Unit is the original weak packaged unit Unit was implicitly imported into package (did not appear in package contains list) Weak (original or not) packaged unit Exception raised if no widestring support is available in the executable ENoWideStringSupport is the exception raised when a run-time 233 occurs, i.e. when widestring routines are called and the application does not contain widestring support. Free the exception instance FreeInstance checks whether the exception instance may be freed prior to calling the inherited FreeInstance. The exception is only freed in case of normal program shutdown, if a heap error occured, the exception instance is not freed. Search for an executable

ExeSearch searches for an executable Name in the list of directories DirList (a list of directories, separator by PathSeparator. If the current OS also searches implicitly in the current working directory, the current directory is searched in the first place.

If the executable is found, then the full path of the executable is returned. If it is not found, an empty string is returned.

No check is performed whether the found file is actually executable.

NULL GUID constant Try to transform a string to a GUID TryStringToGUID tries to convert the string S to a TGUID value, returned in GUID. It returns True if the conversion succeeds, and False if the string S does not contain a valid GUID notation. The string S must be 38 characters long, must start with { and end on }, and contain a valid GUID string (hex number grouped using 8-4-4-4-12 digits). In case S does not contain a valid GUID number, False is returned. Return the index of a GUID in an array of GUID values GuidCase returns the index of GUID in the array List, where 0 denotes the first element in the list. If GUID is not present in the list, -1 is returned.`