unit sysutils

Various system utilities

author: Tomasz Biela (Tebe)


http://www.freepascal.org/docs-html/rtl/sysutils/index-5.html

Constants:

name:value:description:
faReadOnly$01
faHidden$02
faSysFile$04
faVolumeID$08
faDirectory$10
faArchive$20
faAnyFile$3f

Types:

name:type:description:
TSearchRecrecord
  • Attr: Byte;
  • Name: TString;
  • FindHandle: Pointer;

end;

Interface:

name:description:
Beep

procedure Beep;


Sound the system bell
    Click

    procedure Click ; assembler;


    Sound the system click
      GetTickCount

      function GetTickCount: cardinal; assembler;


      Get tick count
        returns:
      • 32bit tick count
      FindFirst

      function FindFirst (const FileMask: TString; Attributes: Byte; var SearchResult: TSearchRec): byte;


      Start a file search and return a findhandle
        parameters:
      • FileMask: string[32]
      • Attributes: Byte
      • SearchResult: TSearchRec
      • returns:
      • =0 file matching the specified criteria is found
      FindNext

      function FindNext(var f: TSearchRec): byte; assembler;


      Find the next entry in a findhandle
        parameters:
      • var f: TSearchRec
      • returns:
      • =0 record matching the criteria, successful
      FindClose

      procedure FindClose(var f: TSearchRec); assembler;


      Close a find handle
        parameters:
      • var f: TSearchRec
      RenameFile

      function RenameFile(var OldName,NewName: TString): Boolean; assembler;


      Renames a file from OldName to NewName
        parameters:
      • var OldName: string[32]
      • var NewName: string[32]
      • returns:
      • TRUE - successful
      • FALSE - I/O error
      DeleteFile

      function DeleteFile(var FileName: TString): Boolean; assembler;


      Delete a file from the filesystem
        parameters:
      • var FileName: string[32]
      • returns:
      • TRUE - the file was successfully removed
      • FALSE - I/O error
      FileExists

      function FileExists(name: TString): Boolean;


      Check whether a particular file exists in the filesystem
        parameters:
      • name: string[32]
      • returns:
      • TRUE - file exists
      • FALSE - file not exists
      IntToStr

      function IntToStr(a: integer): ^string; assembler;


      Convert an integer value to a decimal string
        parameters:
      • a: integer
      • returns:
      • pointer to string
      StrToInt

      function StrToInt(const s: char): byte; assembler; overload;


      Convert a char to an byte value
        parameters:
      • s: char
      • returns:
      • byte
      StrToInt

      function StrToInt(const s: TString): integer; assembler; overload;


      Convert a string to an integer value
        parameters:
      • s: string[32]
      • returns:
      • integer (32bit)
      IntToHex

      function IntToHex(Value: cardinal; Digits: byte): TString; register; assembler;


      Convert an integer value to a hexadecimal string
        parameters:
      • Value: cardinal (32bit)
      • Digits - number of characters
      • returns:
      • string[32]
      StrToFloat

      function StrToFloat(var s: TString): real;


      Convert a string to a floating-point value
        parameters:
      • var s: string[32]
      • returns:
      • real (Q24.8)
      ExtractFileExt

      function ExtractFileExt(const a: string): TString;


      Return the extension from a filename
        parameters:
      • const a: string[255]
      • returns:
      • string[32]
      ExtractFilePath

      function ExtractFilePath(const a: string): string;


      Extract the path from a filename
        parameters:
      • const a: string[255]
      • returns:
      • string[255]
      AnsiUpperCase

      function AnsiUpperCase(const a: string): string;


      Return an uppercase version of a string
        parameters:
      • const a: string[255]
      • returns:
      • string[255]
      Now

      function Now: TDateTime;


      Read actual Date-Time (Sparta DOS X, R-Time 8, SIO Real-Time Clock)
        returns:
      • TDateTime
      Date

      function Date: TDateTime;


      Read actual Date
        returns:
      • TDateTime
      DateToStr

      function DateToStr(d: TDateTime): TString;


      Converts a TDateTime value to a date string.
        parameters:
      • d: TDateTime
      • returns:
      • TString
      TimeToStr

      function TimeToStr(d: TDateTime): TString;


      Converts a TDateTime value to a time string.
        parameters:
      • d: TDateTime
      • returns:
      • TString
      DecodeDate

      procedure DecodeDate(d: TDateTime; var yy,mm,dd: byte);


      Decode a TDateTime to a year,month,day triplet
        parameters:
      • d: TDateTime
      • yy: byte - year
      • mm: byte - month
      • dd: byte - day
      DecodeTime

      procedure DecodeTime(d: TDateTime; var h,m,s: byte);


      Decode a TDateTime to a hour,minute,second triplet
        parameters:
      • d: TDateTime
      • h: byte - hour
      • m: byte - minute
      • s: byte - second
      DecodeDateTime

      procedure DecodeDateTime(d: TDateTime; var yy,mm,dd,h,m,s: byte);


      Decode a TDateTime to a year,month,day, hour,minute,second
        parameters:
      • d: TDateTime
      • yy: byte - year
      • mm: byte - month
      • dd: byte - day
      • h: byte - hour
      • m: byte - minute
      • s: byte - second
      BoolToStr

      function BoolToStr(B: Boolean; UseBoolStrs: Boolean): TString;


      BoolToStr converts the boolean B to one of the strings 'TRUE' or 'FALSE'
        parameters:
      • B: Boolean
      • UseBoolStrs: Boolean
      • returns:
      • TString
      StrToBool

      function StrToBool(const S: TString): Boolean;


      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.
        parameters:
      • S: TString
      • returns:
      • Boolean
      IsLeapYear

      function IsLeapYear(Year: Word): boolean;


      IsLeapYear returns True if Year is a leap year, False otherwise.
        parameters:
      • Year: Word
      • returns:
      • Boolean
      EncodeDate

      function EncodeDate(Year, Month, Day: Byte): TDateTime;


      EncodeDate encodes the Year, Month and Day variables to a date in TDateTime format. It does the opposite of the DecodeDate procedure.
        parameters:
      • Year: Byte
      • Month: Byte
      • Day: Byte
      • returns:
      • TDateTime
      EncodeTime

      function EncodeTime(Hour, Minute, Second: Byte): TDateTime;


      EncodeTime encodes the Hour, Minute and Second variables to a date in TDateTime format. It does the opposite of the DecodeTime procedure.
        parameters:
      • Hour: Byte
      • Minute: Byte
      • Second: Byte
      • returns:
      • TDateTime
      EncodeDateTime

      function EncodeDateTime(Year, Month, Day, Hour, Minute, Second: Byte): TDateTime;


      EncodeDateTime encodes the values Year, Month, Day, Hour, Minute and Second to a date/time valueand returns this value.
        parameters:
      • Year: Byte
      • Month: Byte
      • Day: Byte
      • Hour: Byte
      • Minute: Byte
      • Second: Byte
      • returns:
      • TDateTime