sysutils.tex 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1999, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The SYSUTILS unit.}
  22. This chapter describes the \file{sysutils} unit. The \var{sysutils} unit
  23. was largely written by Gertjan Schouten, and completed by michael Van Canneyt.
  24. It aims to be compatible to the Delphi sysutils unit, but in contrast with
  25. the latter, it is designed to work on multiple platforms.
  26. This chapter starts out with a definition of all types and constants
  27. that are defined, followed by a complete explanation of each function.
  28. \section{Constants and types}
  29. The following general-purpose constants are defined:
  30. \begin{verbatim}
  31. const
  32. SecsPerDay = 24 * 60 * 60; // Seconds and milliseconds per day
  33. MSecsPerDay = SecsPerDay * 1000;
  34. DateDelta = 693594; // Days between 1/1/0001 and 12/31/1899
  35. Eoln = #10;
  36. \end{verbatim}
  37. The following types are used frequently in date and time functions.
  38. They are the same on all platforms.
  39. \begin{verbatim}
  40. type
  41. TSystemTime = record
  42. Year, Month, Day: word;
  43. Hour, Minute, Second, MilliSecond: word;
  44. end ;
  45. TDateTime = double;
  46. TTimeStamp = record
  47. Time: integer; { Number of milliseconds since midnight }
  48. Date: integer; { One plus number of days since 1/1/0001 }
  49. end ;
  50. \end{verbatim}
  51. The following type is used in the \seep{FindFirst},\seep{FindNext}
  52. and \seep{FindClose} functions. The \var{win32} version differs from
  53. the other versions. If code is to be portable, that part shouldn't
  54. be used.
  55. \begin{verbatim}
  56. Type
  57. THandle = Longint;
  58. TSearchRec = Record
  59. Time,Size, Attr : Longint;
  60. Name : TFileName;
  61. ExcludeAttr : Longint;
  62. FindHandle : THandle;
  63. {$ifdef Win32}
  64. FindData : TWin32FindData;
  65. {$endif}
  66. end;
  67. \end{verbatim}
  68. The following constants are file-attributes that need to be matched in the
  69. findfirst call.
  70. \begin{verbatim}
  71. Const
  72. faReadOnly = $00000001;
  73. faHidden = $00000002;
  74. faSysFile = $00000004;
  75. faVolumeId = $00000008;
  76. faDirectory = $00000010;
  77. faArchive = $00000020;
  78. faAnyFile = $0000003f;
  79. \end{verbatim}
  80. The following constants can be used in the \seef{FileOpen} call.
  81. \begin{verbatim}
  82. Const
  83. fmOpenRead = $0000;
  84. fmOpenWrite = $0001;
  85. fmOpenReadWrite = $0002;
  86. \end{verbatim}
  87. The following variables are used in the case translation routines.
  88. \begin{verbatim}
  89. type
  90. TCaseTranslationTable = array[0..255] of char;
  91. var
  92. UpperCaseTable: TCaseTranslationTable;
  93. LowerCaseTable: TCaseTranslationTable;
  94. \end{verbatim}
  95. The initialization code of the \file{sysutils} unit fills these
  96. tables with the appropriate values. For the win32 and go32v2
  97. versions, this information is obtained from the operating system.
  98. The following constants control the formatting of dates.
  99. For the Win32 version of the \file{sysutils} unit, these
  100. constants are set according to the internationalization
  101. settings of Windows by the initialization code of the unit.
  102. \begin{verbatim}
  103. Const
  104. DateSeparator: char = '-';
  105. ShortDateFormat: string = 'd/m/y';
  106. LongDateFormat: string = 'dd" "mmmm" "yyyy';
  107. ShortMonthNames: array[1..12] of string[128] =
  108. ('Jan','Feb','Mar','Apr','May','Jun',
  109. 'Jul','Aug','Sep','Oct','Nov','Dec');
  110. LongMonthNames: array[1..12] of string[128] =
  111. ('January','February','March','April',
  112. 'May','June','July','August',
  113. 'September','October','November','December');
  114. ShortDayNames: array[1..7] of string[128] =
  115. ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  116. LongDayNames: array[1..7] of string[128] =
  117. ('Sunday','Monday','Tuesday','Wednesday',
  118. 'Thursday','Friday','Saturday');
  119. \end{verbatim}
  120. The following constants control the formatting of times.
  121. For the Win32 version of the \file{sysutils} unit, these
  122. constants are set according to the internationalization
  123. settings of Windows by the initialization code of the unit.
  124. \begin{verbatim}
  125. Const
  126. ShortTimeFormat: string = 'hh:nn';
  127. LongTimeFormat: string = 'hh:nn:ss';
  128. TimeSeparator: char = ':';
  129. TimeAMString: string[7] = 'AM';
  130. TimePMString: string[7] = 'PM';
  131. \end{verbatim}
  132. The following constants control the formatting of currencies
  133. and numbers. For the Win32 version of the \file{sysutils} unit,
  134. these constants are set according to the internationalization
  135. settings of Windows by the initialization code of the unit.
  136. \begin{verbatim}
  137. Const
  138. DecimalSeparator : Char = '.';
  139. ThousandSeparator : Char = ',';
  140. CurrencyDecimals : Byte = 2;
  141. CurrencyString : String[7] = '$';
  142. { Format to use when formatting currency :
  143. 0 = $1 1 = 1$ 2 = $ 1 3 = 1 $
  144. 4 = Currency string replaces decimal indicator.
  145. e.g. 1$50
  146. }
  147. CurrencyFormat : Byte = 1;
  148. { Same as above, only for negative currencies:
  149. 0 = ($1)
  150. 1 = -$1
  151. 2 = $-1
  152. 3 = $1-
  153. 4 = (1$)
  154. 5 = -1$
  155. 6 = 1-$
  156. 7 = 1$-
  157. 8 = -1 $
  158. 9 = -$ 1
  159. 10 = $ 1-
  160. }
  161. NegCurrFormat : Byte = 5;
  162. \end{verbatim}
  163. The following types are used in various string functions.
  164. \begin{verbatim}
  165. type
  166. PString = ^String;
  167. TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
  168. \end{verbatim}
  169. The following constants are used in the file name handling routines. Do not
  170. use a slash of backslash character directly as a path separator; instead
  171. use the \var{OsDirSeparator} character.
  172. \begin{verbatim}
  173. Const
  174. DirSeparators : set of char = ['/','\'];
  175. {$ifdef Linux}
  176. OSDirSeparator = '/';
  177. {$else}
  178. OsDirSeparator = '\';
  179. {$endif}
  180. \end{verbatim}
  181. \section{Date and time functions}
  182. \subsection{Date and time formatting characters}
  183. Various date and time formatting routines accept a format string.
  184. to format the date and or time. The following characters can be used
  185. to control the date and time formatting:
  186. \begin{description}
  187. \item[c] : shortdateformat + ' ' + shorttimeformat
  188. \item[d] : day of month
  189. \item[dd] : day of month (leading zero)
  190. \item[ddd] : day of week (abbreviation)
  191. \item[dddd] : day of week (full)
  192. \item[ddddd] : shortdateformat
  193. \item[dddddd] : longdateformat
  194. \item[m] : month
  195. \item[mm] : month (leading zero)
  196. \item[mmm] : month (abbreviation)
  197. \item[mmmm] : month (full)
  198. \item[y] : year (four digits)
  199. \item[yy] : year (two digits)
  200. \item[yyyy] : year (with century)
  201. \item[h] : hour
  202. \item[hh] : hour (leading zero)
  203. \item[n] : minute
  204. \item[nn] : minute (leading zero)
  205. \item[s] : second
  206. \item[ss] : second (leading zero)
  207. \item[t] : shorttimeformat
  208. \item[tt] : longtimeformat
  209. \item[am/pm] : use 12 hour clock and display am and pm accordingly
  210. \item[a/p] : use 12 hour clock and display a and p accordingly
  211. \item[/] : insert date seperator
  212. \item[:] : insert time seperator
  213. \item["xx"] : literal text
  214. \item['xx'] : literal text
  215. \end{description}
  216. \begin{function}{Date}
  217. \Declaration
  218. Function Date: TDateTime;
  219. \Description
  220. \Errors
  221. \SeeAlso
  222. \end{function}
  223. \begin{function}{DateTimeToFileDate}
  224. \Declaration
  225. Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
  226. \Description
  227. \Errors
  228. \SeeAlso
  229. \end{function}
  230. \begin{function}{DateTimeToStr}
  231. \Declaration
  232. Function DateTimeToStr(DateTime: TDateTime): string;
  233. \Description
  234. \Errors
  235. \SeeAlso
  236. \end{function}
  237. \begin{procedure}{DateTimeToString}
  238. \Declaration
  239. Procedure DateTimeToString(var Result: string; const FormatStr: string; const DateTime: TDateTime);
  240. \Description
  241. \Errors
  242. \SeeAlso
  243. \end{procedure}
  244. \begin{procedure}{DateTimeToSystemTime}
  245. \Declaration
  246. Procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);
  247. \Description
  248. \Errors
  249. \SeeAlso
  250. \end{procedure}
  251. \begin{function}{DateTimeToTimeStamp}
  252. \Declaration
  253. Function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
  254. \Description
  255. \Errors
  256. \SeeAlso
  257. \end{function}
  258. \begin{function}{DateToStr}
  259. \Declaration
  260. Function DateToStr(Date: TDateTime): string;
  261. \Description
  262. \Errors
  263. \SeeAlso
  264. \end{function}
  265. \begin{function}{DayOfWeek}
  266. \Declaration
  267. Function DayOfWeek(DateTime: TDateTime): integer;
  268. \Description
  269. \Errors
  270. \SeeAlso
  271. \end{function}
  272. \begin{procedure}{DecodeDate}
  273. \Declaration
  274. Procedure DecodeDate(Date: TDateTime; var Year, Month, Day: word);
  275. \Description
  276. \Errors
  277. \SeeAlso
  278. \end{procedure}
  279. \begin{procedure}{DecodeTime}
  280. \Declaration
  281. Procedure DecodeTime(Time: TDateTime; var Hour, Minute, Second, MilliSecond: word);
  282. \Description
  283. \Errors
  284. \SeeAlso
  285. \end{procedure}
  286. \begin{function}{EncodeDate}
  287. \Declaration
  288. Function EncodeDate(Year, Month, Day :word): TDateTime;
  289. \Description
  290. \Errors
  291. \SeeAlso
  292. \end{function}
  293. \begin{function}{EncodeTime}
  294. \Declaration
  295. Function EncodeTime(Hour, Minute, Second, MilliSecond:word): TDateTime;
  296. \Description
  297. \Errors
  298. \SeeAlso
  299. \end{function}
  300. \begin{function}{FileDateToDateTime}
  301. \Declaration
  302. Function FileDateToDateTime(Filedate : Longint) : TDateTime;
  303. \Description
  304. \Errors
  305. \SeeAlso
  306. \end{function}
  307. \begin{function}{FormatDateTime}
  308. \Declaration
  309. Function FormatDateTime(FormatStr: string; DateTime: TDateTime):string;
  310. \Description
  311. \Errors
  312. \SeeAlso
  313. \end{function}
  314. \begin{function}{IncMonth}
  315. \Declaration
  316. Function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer): TDateTime;
  317. \Description
  318. \Errors
  319. \SeeAlso
  320. \end{function}
  321. \begin{function}{IsLeapYear}
  322. \Declaration
  323. Function IsLeapYear(Year: Word): boolean;
  324. \Description
  325. \Errors
  326. \SeeAlso
  327. \end{function}
  328. \begin{function}{MSecsToTimeStamp}
  329. \Declaration
  330. Function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
  331. \Description
  332. \Errors
  333. \SeeAlso
  334. \end{function}
  335. \begin{function}{Now}
  336. \Declaration
  337. Function Now: TDateTime;
  338. \Description
  339. \Errors
  340. \SeeAlso
  341. \end{function}
  342. \begin{function}{StrToDate}
  343. \Declaration
  344. Function StrToDate(const S: string): TDateTime;
  345. \Description
  346. \Errors
  347. \SeeAlso
  348. \end{function}
  349. \begin{function}{StrToDateTime}
  350. \Declaration
  351. Function StrToDateTime(const S: string): TDateTime;
  352. \Description
  353. \Errors
  354. \SeeAlso
  355. \end{function}
  356. \begin{function}{StrToTime}
  357. \Declaration
  358. Function StrToTime(const S: string): TDateTime;
  359. \Description
  360. \Errors
  361. \SeeAlso
  362. \end{function}
  363. \begin{function}{SystemTimeToDateTime}
  364. \Declaration
  365. Function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
  366. \Description
  367. \Errors
  368. \SeeAlso
  369. \end{function}
  370. \begin{function}{Time}
  371. \Declaration
  372. Function Time: TDateTime;
  373. \Description
  374. \Errors
  375. \SeeAlso
  376. \end{function}
  377. \begin{function}{TimeStampToDateTime}
  378. \Declaration
  379. Function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
  380. \Description
  381. \Errors
  382. \SeeAlso
  383. \end{function}
  384. \begin{function}{TimeStampToMSecs}
  385. \Declaration
  386. Function TimeStampToMSecs(const TimeStamp: TTimeStamp): comp;
  387. \Description
  388. \Errors
  389. \SeeAlso
  390. \end{function}
  391. \begin{function}{TimeToStr}
  392. \Declaration
  393. Function TimeToStr(Time: TDateTime): string;
  394. \Description
  395. \Errors
  396. \SeeAlso
  397. \end{function}
  398. \section{Disk functions}
  399. \begin{function}{CreateDir}
  400. \Declaration
  401. Function CreateDir(Const NewDir : String) : Boolean;
  402. \Description
  403. \Errors
  404. \SeeAlso
  405. \end{function}
  406. \begin{function}{DiskFree}
  407. \Declaration
  408. Function DiskFree(Drive : Byte) : Longint;
  409. \Description
  410. \Errors
  411. \SeeAlso
  412. \end{function}
  413. \begin{function}{DiskSize}
  414. \Declaration
  415. Function DiskSize(Drive : Byte) : Longint;
  416. \Description
  417. \Errors
  418. \SeeAlso
  419. \end{function}
  420. \begin{function}{GetCurrentDir}
  421. \Declaration
  422. Function GetCurrentDir : String;
  423. \Description
  424. \Errors
  425. \SeeAlso
  426. \end{function}
  427. \begin{function}{RemoveDir}
  428. \Declaration
  429. Function RemoveDir(Const Dir : String) : Boolean;
  430. \Description
  431. \Errors
  432. \SeeAlso
  433. \end{function}
  434. \begin{function}{SetCurrentDir}
  435. \Declaration
  436. Function SetCurrentDir(Const NewDir : String) : Boolean;
  437. \Description
  438. \Errors
  439. \SeeAlso
  440. \end{function}
  441. \section{File handling functions}
  442. \begin{function}{ChangeFileExt}
  443. \Declaration
  444. Function ChangeFileExt(const FileName, Extension: string): string;
  445. \Description
  446. \Errors
  447. \SeeAlso
  448. \end{function}
  449. \begin{function}{DeleteFile}
  450. \Declaration
  451. Function DeleteFile(Const FileName : String) : Boolean;
  452. \Description
  453. \Errors
  454. \SeeAlso
  455. \end{function}
  456. \begin{procedure}{DoDirSeparators}
  457. \Declaration
  458. Procedure DoDirSeparators(Var FileName : String);
  459. \Description
  460. \Errors
  461. \SeeAlso
  462. \end{procedure}
  463. \begin{function}{ExpandFileName}
  464. \Declaration
  465. Function ExpandFileName(Const FileName : string): String;
  466. \Description
  467. \Errors
  468. \SeeAlso
  469. \end{function}
  470. \begin{function}{ExpandUNCFileName}
  471. \Declaration
  472. Function ExpandUNCFileName(Const FileName : string): String;
  473. \Description
  474. \Errors
  475. \SeeAlso
  476. \end{function}
  477. \begin{function}{ExtractFileDir}
  478. \Declaration
  479. Function ExtractFileDir(Const FileName : string): string;
  480. \Description
  481. \Errors
  482. \SeeAlso
  483. \end{function}
  484. \begin{function}{ExtractFileDrive}
  485. \Declaration
  486. Function ExtractFileDrive(const FileName: string): string;
  487. \Description
  488. \Errors
  489. \SeeAlso
  490. \end{function}
  491. \begin{function}{ExtractFileExt}
  492. \Declaration
  493. Function ExtractFileExt(const FileName: string): string;
  494. \Description
  495. \Errors
  496. \SeeAlso
  497. \end{function}
  498. \begin{function}{ExtractFileName}
  499. \Declaration
  500. Function ExtractFileName(const FileName: string): string;
  501. \Description
  502. \Errors
  503. \SeeAlso
  504. \end{function}
  505. \begin{function}{ExtractFilePath}
  506. \Declaration
  507. Function ExtractFilePath(const FileName: string): string;
  508. \Description
  509. \Errors
  510. \SeeAlso
  511. \end{function}
  512. \begin{function}{ExtractRelativepath}
  513. \Declaration
  514. Function ExtractRelativepath(Const BaseName,DestNAme : String): String;
  515. \Description
  516. \Errors
  517. \SeeAlso
  518. \end{function}
  519. \begin{function}{FileAge}
  520. \Declaration
  521. Function FileAge(Const FileName : String): Longint;
  522. \Description
  523. \Errors
  524. \SeeAlso
  525. \end{function}
  526. \begin{procedure}{FileClose}
  527. \Declaration
  528. Procedure FileClose(Handle : Longint);
  529. \Description
  530. \Errors
  531. \SeeAlso
  532. \end{procedure}
  533. \begin{function}{FileCreate}
  534. \Declaration
  535. Function FileCreate(Const FileName : String) : Longint;
  536. \Description
  537. \Errors
  538. \SeeAlso
  539. \end{function}
  540. \begin{function}{FileExists}
  541. \Declaration
  542. Function FileExists(Const FileName : String) : Boolean;
  543. \Description
  544. \Errors
  545. \SeeAlso
  546. \end{function}
  547. \begin{function}{FileGetAttr}
  548. \Declaration
  549. Function FileGetAttr(Const FileName : String) : Longint;
  550. \Description
  551. \Errors
  552. \SeeAlso
  553. \end{function}
  554. \begin{function}{FileGetDate}
  555. \Declaration
  556. Function FileGetDate(Handle : Longint) : Longint;
  557. \Description
  558. \Errors
  559. \SeeAlso
  560. \end{function}
  561. \begin{function}{FileOpen}
  562. \Declaration
  563. Function FileOpen(Const FileName : string; Mode : Integer) : Longint;
  564. \Description
  565. \Errors
  566. \SeeAlso
  567. \end{function}
  568. \begin{function}{FileRead}
  569. \Declaration
  570. Function FileRead(Handle : Longint; Var Buffer; Count : longint) : Longint;
  571. \Description
  572. \Errors
  573. \SeeAlso
  574. \end{function}
  575. \begin{function}{FileSearch}
  576. \Declaration
  577. Function FileSearch(Const Name, DirList : String) : String;
  578. \Description
  579. \Errors
  580. \SeeAlso
  581. \end{function}
  582. \begin{function}{FileSeek}
  583. \Declaration
  584. Function FileSeek(Handle,Offset,Origin : Longint) : Longint;
  585. \Description
  586. \Errors
  587. \SeeAlso
  588. \end{function}
  589. \begin{function}{FileSetAttr}
  590. \Declaration
  591. Function FileSetAttr(Const Filename : String; Attr: longint) : Longint;
  592. \Description
  593. \Errors
  594. \SeeAlso
  595. \end{function}
  596. \begin{function}{FileSetDate}
  597. \Declaration
  598. Function FileSetDate(Handle,Age : Longint) : Longint;
  599. \Description
  600. \Errors
  601. \SeeAlso
  602. \end{function}
  603. \begin{function}{FileTruncate}
  604. \Declaration
  605. Function FileTruncate(Handle,Size: Longint) : boolean;
  606. \Description
  607. \Errors
  608. \SeeAlso
  609. \end{function}
  610. \begin{function}{FileWrite}
  611. \Declaration
  612. Function FileWrite(Handle : Longint; Var Buffer; Count : Longint) : Longint;
  613. \Description
  614. \Errors
  615. \SeeAlso
  616. \end{function}
  617. \begin{procedure}{FindClose}
  618. \Declaration
  619. Procedure FindClose(Var F : TSearchrec);
  620. \Description
  621. \Errors
  622. \SeeAlso
  623. \end{procedure}
  624. \begin{function}{FindFirst}
  625. \Declaration
  626. Function FindFirst(Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  627. \Description
  628. \Errors
  629. \SeeAlso
  630. \end{function}
  631. \begin{function}{FindNext}
  632. \Declaration
  633. Function FindNext(Var Rslt : TSearchRec) : Longint;
  634. \Description
  635. \Errors
  636. \SeeAlso
  637. \end{function}
  638. \begin{function}{GetDirs}
  639. \Declaration
  640. Function GetDirs(Var DirName : String; Var Dirs : Array of pchar) : Longint;
  641. \Description
  642. \Errors
  643. \SeeAlso
  644. \end{function}
  645. \begin{function}{RenameFile}
  646. \Declaration
  647. Function RenameFile(Const OldName, NewName : String) : Boolean;
  648. \Description
  649. \Errors
  650. \SeeAlso
  651. \end{function}
  652. \begin{function}{SetDirSeparators}
  653. \Declaration
  654. Function SetDirSeparators(Const FileName : String) : String;
  655. \Description
  656. \Errors
  657. \SeeAlso
  658. \end{function}
  659. \section{PChar functions}
  660. \begin{function}{StrAlloc}
  661. \Declaration
  662. Function StrAlloc(Size: cardinal): PChar;
  663. \Description
  664. \Errors
  665. \SeeAlso
  666. \end{function}
  667. \begin{function}{StrBufSize}
  668. \Declaration
  669. Function StrBufSize(var Str: PChar): cardinal;
  670. \Description
  671. \Errors
  672. \SeeAlso
  673. \end{function}
  674. \begin{procedure}{StrDispose}
  675. \Declaration
  676. Procedure StrDispose(var Str: PChar);
  677. \Description
  678. \Errors
  679. \SeeAlso
  680. \end{procedure}
  681. \begin{function}{StrPCopy}
  682. \Declaration
  683. Function StrPCopy(Dest: PChar; Source: string): PChar;
  684. \Description
  685. \Errors
  686. \SeeAlso
  687. \end{function}
  688. \begin{function}{StrPLCopy}
  689. \Declaration
  690. Function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
  691. \Description
  692. \Errors
  693. \SeeAlso
  694. \end{function}
  695. \begin{function}{StrPas}
  696. \Declaration
  697. Function StrPas(Str: PChar): string;
  698. \Description
  699. \Errors
  700. \SeeAlso
  701. \end{function}
  702. \begin{function}{StrCat}
  703. \Declaration
  704. Function StrCat(dest,source : pchar) : pchar;
  705. \Description
  706. \Errors
  707. \SeeAlso
  708. \end{function}
  709. \begin{function}{StrComp}
  710. \Declaration
  711. Function StrComp(str1,str2 : pchar) : longint;
  712. \Description
  713. \Errors
  714. \SeeAlso
  715. \end{function}
  716. \begin{function}{StrCopy}
  717. \Declaration
  718. Function StrCopy(dest,source : pchar) : pchar;
  719. \Description
  720. \Errors
  721. \SeeAlso
  722. \end{function}
  723. \begin{function}{StrECopy}
  724. \Declaration
  725. Function StrECopy(dest,source : pchar) : pchar;
  726. \Description
  727. \Errors
  728. \SeeAlso
  729. \end{function}
  730. \begin{function}{StrEnd}
  731. \Declaration
  732. Function StrEnd(p : pchar) : pchar;
  733. \Description
  734. \Errors
  735. \SeeAlso
  736. \end{function}
  737. \begin{function}{StrIComp}
  738. \Declaration
  739. Function StrIComp(str1,str2 : pchar) : longint;
  740. \Description
  741. \Errors
  742. \SeeAlso
  743. \end{function}
  744. \begin{function}{StrLCat}
  745. \Declaration
  746. Function StrLCat(dest,source : pchar;l : longint) : pchar;
  747. \Description
  748. \Errors
  749. \SeeAlso
  750. \end{function}
  751. \begin{function}{StrLComp}
  752. \Declaration
  753. Function StrLComp(str1,str2 : pchar;l : longint) : longint;
  754. \Description
  755. \Errors
  756. \SeeAlso
  757. \end{function}
  758. \begin{function}{StrLCopy}
  759. \Declaration
  760. Function StrLCopy(dest,source : pchar;maxlen : longint) : pchar;
  761. \Description
  762. \Errors
  763. \SeeAlso
  764. \end{function}
  765. \begin{function}{StrLen}
  766. \Declaration
  767. Function StrLen(p : pchar) : longint;
  768. \Description
  769. \Errors
  770. \SeeAlso
  771. \end{function}
  772. \begin{function}{StrLIComp}
  773. \Declaration
  774. Function StrLIComp(str1,str2 : pchar;l : longint) : longint;
  775. \Description
  776. \Errors
  777. \SeeAlso
  778. \end{function}
  779. \begin{function}{StrLower}
  780. \Declaration
  781. Function strlower(p : pchar) : pchar;
  782. \Description
  783. \Errors
  784. \SeeAlso
  785. \end{function}
  786. \begin{function}{StrMove}
  787. \Declaration
  788. Function StrMove(dest,source : pchar;l : longint) : pchar;
  789. \Description
  790. \Errors
  791. \SeeAlso
  792. \end{function}
  793. \begin{function}{StrNew}
  794. \Declaration
  795. Function StrNew(p : pchar) : pchar;
  796. \Description
  797. \Errors
  798. \SeeAlso
  799. \end{function}
  800. \begin{function}{StrPos}
  801. \Declaration
  802. Function StrPos(str1,str2 : pchar) : pchar;
  803. \Description
  804. \Errors
  805. \SeeAlso
  806. \end{function}
  807. \begin{function}{StrRScan}
  808. \Declaration
  809. Function StrRScan(p : pchar;c : char) : pchar;
  810. \Description
  811. \Errors
  812. \SeeAlso
  813. \end{function}
  814. \begin{function}{StrScan}
  815. \Declaration
  816. Function StrScan(p : pchar;c : char) : pchar;
  817. \Description
  818. \Errors
  819. \SeeAlso
  820. \end{function}
  821. \begin{function}{StrUpper}
  822. \Declaration
  823. Function StrUpper(p : pchar) : pchar;
  824. \Description
  825. \Errors
  826. \SeeAlso
  827. \end{function}
  828. \section{String functions}
  829. \begin{function}{AdjustLineBreaks}
  830. \Declaration
  831. Function AdjustLineBreaks(const S: string): string;
  832. \Description
  833. \Errors
  834. \SeeAlso
  835. \end{function}
  836. \begin{function}{AnsiCompareStr}
  837. \Declaration
  838. Function AnsiCompareStr(const S1, S2: string): integer;
  839. \Description
  840. \Errors
  841. \SeeAlso
  842. \end{function}
  843. \begin{function}{AnsiCompareText}
  844. \Declaration
  845. Function AnsiCompareText(const S1, S2: string): integer;
  846. \Description
  847. \Errors
  848. \SeeAlso
  849. \end{function}
  850. \begin{function}{AnsiExtractQuotedStr}
  851. \Declaration
  852. Function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
  853. \Description
  854. \Errors
  855. \SeeAlso
  856. \end{function}
  857. \begin{function}{AnsiLastChar}
  858. \Declaration
  859. Function AnsiLastChar(const S: string): PChar;
  860. \Description
  861. \Errors
  862. \SeeAlso
  863. \end{function}
  864. \begin{function}{AnsiLowerCase}
  865. \Declaration
  866. Function AnsiLowerCase(const s: string): string;
  867. \Description
  868. \Errors
  869. \SeeAlso
  870. \end{function}
  871. \begin{function}{AnsiQuotedStr}
  872. \Declaration
  873. Function AnsiQuotedStr(const S: string; Quote: char): string;
  874. \Description
  875. \Errors
  876. \SeeAlso
  877. \end{function}
  878. \begin{function}{AnsiStrComp}
  879. \Declaration
  880. Function AnsiStrComp(S1, S2: PChar): integer;
  881. \Description
  882. \Errors
  883. \SeeAlso
  884. \end{function}
  885. \begin{function}{AnsiStrIComp}
  886. \Declaration
  887. Function AnsiStrIComp(S1, S2: PChar): integer;
  888. \Description
  889. \Errors
  890. \SeeAlso
  891. \end{function}
  892. \begin{function}{AnsiStrLComp}
  893. \Declaration
  894. Function AnsiStrLComp(S1, S2: PChar; MaxLen: cardinal): integer;
  895. \Description
  896. \Errors
  897. \SeeAlso
  898. \end{function}
  899. \begin{function}{AnsiStrLIComp}
  900. \Declaration
  901. Function AnsiStrLIComp(S1, S2: PChar; MaxLen: cardinal): integer;
  902. \Description
  903. \Errors
  904. \SeeAlso
  905. \end{function}
  906. \begin{function}{AnsiStrLast}
  907. \Declaration
  908. Function AnsiStrLast(Str: PChar): PChar;
  909. \Description
  910. \Errors
  911. \SeeAlso
  912. \end{function}
  913. \begin{function}{CharAnsiStrLower}
  914. \Declaration
  915. Function AnsiStrLower(Str: PChar): PChar;
  916. \Description
  917. \Errors
  918. \SeeAlso
  919. \end{function}
  920. \begin{function}{AnsiStrUpper}
  921. \Declaration
  922. Function AnsiStrUpper(Str: PChar): PChar;
  923. \Description
  924. \Errors
  925. \SeeAlso
  926. \end{function}
  927. \begin{function}{AnsiUpperCase}
  928. \Declaration
  929. Function AnsiUpperCase(const s: string): string;
  930. \Description
  931. \Errors
  932. \SeeAlso
  933. \end{function}
  934. \begin{procedure}{AppendStr}
  935. \Declaration
  936. Procedure AppendStr(var Dest: PString; const S: string);
  937. \Description
  938. \Errors
  939. \SeeAlso
  940. \end{procedure}
  941. \begin{procedure}{AssignStr}
  942. \Declaration
  943. Procedure AssignStr(var P: PString; const S: string);
  944. \Description
  945. \Errors
  946. \SeeAlso
  947. \end{procedure}
  948. \begin{function}{BCDToInt}
  949. \Declaration
  950. Function BCDToInt(Value: integer): integer;
  951. \Description
  952. \Errors
  953. \SeeAlso
  954. \end{function}
  955. \begin{function}{CompareMem}
  956. \Declaration
  957. Function CompareMem(P1, P2: Pointer; Length: cardinal): integer;
  958. \Description
  959. \Errors
  960. \SeeAlso
  961. \end{function}
  962. \begin{function}{CompareStr}
  963. \Declaration
  964. Function CompareStr(const S1, S2: string): Integer;
  965. \Description
  966. \Errors
  967. \SeeAlso
  968. \end{function}
  969. \begin{function}{CompareText}
  970. \Declaration
  971. Function CompareText(const S1, S2: string): integer;
  972. \Description
  973. \Errors
  974. \SeeAlso
  975. \end{function}
  976. \begin{procedure}{DisposeStr}
  977. \Declaration
  978. Procedure DisposeStr(S: PString);
  979. \Description
  980. \Errors
  981. \SeeAlso
  982. \end{procedure}
  983. \begin{function}{FloatToStr}
  984. \Declaration
  985. Function FloatToStr(Value: Extended): String;
  986. \Description
  987. \Errors
  988. \SeeAlso
  989. \end{function}
  990. \begin{function}{FloatToStrF}
  991. \Declaration
  992. Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer): String;
  993. \Description
  994. \Errors
  995. \SeeAlso
  996. \end{function}
  997. \begin{procedure}{FmtStr}
  998. \Declaration
  999. Procedure (Var Res: String; Const Fmt : String; Const args: Array of const);
  1000. \Description
  1001. \Errors
  1002. \SeeAlso
  1003. \end{procedure}
  1004. \begin{function}{Format}
  1005. \Declaration
  1006. Function Format(Const Fmt : String; const Args : Array of const) : String;
  1007. \Description
  1008. \Errors
  1009. \SeeAlso
  1010. \end{function}
  1011. \begin{function}{FormatBuf}
  1012. \Declaration
  1013. Function FormatBuf(Var Buffer; BufLen : Cardinal; Const Fmt; fmtLen : Cardinal; Const Args : Array of const) : Cardinal;
  1014. \Description
  1015. \Errors
  1016. \SeeAlso
  1017. \end{function}
  1018. \begin{function}{IntToHex}
  1019. \Declaration
  1020. Function IntToHex(Value: integer; Digits: integer): string;
  1021. \Description
  1022. \Errors
  1023. \SeeAlso
  1024. \end{function}
  1025. \begin{function}{IntToStr}
  1026. \Declaration
  1027. Function IntToStr(Value: integer): string;
  1028. \Description
  1029. \Errors
  1030. \SeeAlso
  1031. \end{function}
  1032. \begin{function}{IsValidIdent}
  1033. \Declaration
  1034. Function IsValidIdent(const Ident: string): boolean;
  1035. \Description
  1036. \Errors
  1037. \SeeAlso
  1038. \end{function}
  1039. \begin{function}{LeftStr}
  1040. \Declaration
  1041. Function LeftStr(const S: string; Count: integer): string;
  1042. \Description
  1043. \Errors
  1044. \SeeAlso
  1045. \end{function}
  1046. \begin{function}{LoadStr}
  1047. \Declaration
  1048. Function LoadStr(Ident: integer): string;
  1049. \Description
  1050. \Errors
  1051. \SeeAlso
  1052. \end{function}
  1053. \begin{function}{LowerCase}
  1054. \Declaration
  1055. Function LowerCase(const s: string): string;
  1056. \Description
  1057. \Errors
  1058. \SeeAlso
  1059. \end{function}
  1060. \begin{function}{NewStr}
  1061. \Declaration
  1062. Function NewStr(const S: string): PString;
  1063. \Description
  1064. \Errors
  1065. \SeeAlso
  1066. \end{function}
  1067. \begin{function}{QuotedStr}
  1068. \Declaration
  1069. Function QuotedStr(const S: string): string;
  1070. \Description
  1071. \Errors
  1072. \SeeAlso
  1073. \end{function}
  1074. \begin{function}{RightStr}
  1075. \Declaration
  1076. Function RightStr(const S: string; Count: integer): string;
  1077. \Description
  1078. \Errors
  1079. \SeeAlso
  1080. \end{function}
  1081. \begin{function}{StrFmt}
  1082. \Declaration
  1083. Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;
  1084. \Description
  1085. \Errors
  1086. \SeeAlso
  1087. \end{function}
  1088. \begin{function}{StrLFmt}
  1089. \Declaration
  1090. Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;
  1091. \Description
  1092. \Errors
  1093. \SeeAlso
  1094. \end{function}
  1095. \begin{function}{StrToInt}
  1096. \Declaration
  1097. Function StrToInt(const s: string): integer;
  1098. \Description
  1099. \Errors
  1100. \SeeAlso
  1101. \end{function}
  1102. \begin{function}{StrToIntDef}
  1103. \Declaration
  1104. Function StrToIntDef(const S: string; Default: integer): integer;
  1105. \Description
  1106. \Errors
  1107. \SeeAlso
  1108. \end{function}
  1109. \begin{function}{Trim}
  1110. \Declaration
  1111. Function Trim(const S: string): string;
  1112. \Description
  1113. \Errors
  1114. \SeeAlso
  1115. \end{function}
  1116. \begin{function}{TrimLeft}
  1117. \Declaration
  1118. Function TrimLeft(const S: string): string;
  1119. \Description
  1120. \Errors
  1121. \SeeAlso
  1122. \end{function}
  1123. \begin{function}{TrimRight}
  1124. \Declaration
  1125. Function TrimRight(const S: string): string;
  1126. \Description
  1127. \Errors
  1128. \SeeAlso
  1129. \end{function}
  1130. \begin{function}{UpperCase}
  1131. \Declaration
  1132. Function UpperCase(const s: string): string;
  1133. \Description
  1134. \Errors
  1135. \SeeAlso
  1136. \end{function}