How about common VCL library functions in borland c ++?

Source: Internet
Author: User

How about common VCL library functions in borland c ++?

Introduction to VCL library functions

1. borland c ++ builder vcl memory management functions

1. AllocMem

Allocate memory blocks of specified bytes in the queue and initialize each allocated byte to 0. The function prototype is as follows:

Void * _ fastcall AllocMem (Cardinal Size );

2. SysFreeMem

Release the specified memory block. The function prototype is as follows:

Int _ fastcall SysFreeMem (void * P );

3. SysReallocMem

The memory specified by the reallocation parameter Size is required. The function prototype is as follows:

Void * _ fastcall SysReallocMem (void * P, int Size );

Ii. Borland C ++ Builder VCL file operation functions

1. FileOpen

Open the specified file. If a positive number is returned, the operation is successful. If the returned value is-1, the operation fails. The function prototype is as follows:

Int _ fastcall FileOpen (const System: AnsiString FileName, int Mode );

2. FileCreate

Create a new file with the specified file name. If a positive number is returned, the operation is successful, and the returned value is the file handle. If the returned value is-1, the operation fails. The function prototype is as follows:

Int _ fastcall FileCreate (const System: AnsiString FileName );

3. FileRead

The function returns the actual number of bytes read from the file to the buffer. The function prototype is as follows;

Int _ fastcall FileRead (int Handle, void * Buffer, int Count );

4. FileWrite

Write the data in the buffer to the current location of the specified file. If the operation succeeds, the function returns the number of bytes actually written. If the returned value is-1, the operation produces an error, the function prototype is as follows:

Int _ fastcall FileWrite (int Handle, const void * Buffer, int Count );

5. FileSeek

Adjust the file pointer to the new location. If the operation succeeds, the new file location is returned. If the operation fails, the function returns-1. The function prototype is as follows:

Int _ fastcall FileSeek (int Handle, int Offset, int Origin );

6. FileClose

Close the specified file. The function prototype is as follows:

Void _ fastcall FileClose (int Handle );

7. FileAge

Returns the time tag of the specified file. If the operation fails,-1 is returned. The function prototype is as follows:

Int _ fastcall FileAge (const System: AnsiString FileName );

8. FileExists

Used to test whether the specified file exists. If the returned result is true or false, the function prototype is as follows:

Bool _ fastcall FileExists (const System: AnsiString FileName );

9. FileGetDate

Returns the DOS time tag of the specified file. If the operation fails, it is near-1. The function prototype is as follows:

Int _ fastcall FileGetDate (int Handle );

10. FileSetDate

Change the DOS time tag of the specified file. If the operation succeeds, 0 is returned. Otherwise, the error code is returned. The function prototype is as follows:

Int _ fastcall FileSetDate (int Handle, int Age );

11. FileGetAttr

Returns the properties of the specified file. If the operation fails, the function returns-1. The function prototype is as follows;

Int _ fastcall FileGetAttr (const System: AnsiString FileName );

12. FileSetAttr

Change the attribute parameters of the specified file. If the operation is successful, 0 is returned. The function prototype is as follows;

Int _ fastcall FileSetAttr (const System: AnsiString FileName, int Attr );

13. FindFirst

Search for files that meet the specified attribute parameters in the specified file directory. If the files that meet the condition are found successfully,

The function returns 0. Otherwise, the function returns an error code. The function prototype is as follows:

Int _ fastcall FindFirst (const System: AnsiString Path, int Attr, TSearchRec &; F );

14. FindNext

Continue to search for the file with the attribute parameters specified by FindFirst. If the file is found successfully, the function returns 0; otherwise, the function returns an error code. The function prototype is as follows:

Int _ fastcall FindNext (TSearchRec &; F );

15. FindClose

Release the memory resources applied for by the FindFirst operation. The function prototype is as follows:

Void _ fastcall FindClose (TSearchRec &; F );

16. DeleteFile

Delete the specified file from the computer disk. If the operation succeeds, the function returns true. The function prototype is as follows:

Bool _ fastcall DeleteFile (const AnsiString FileName );

17. RenameFile

Change the name of the specified file. If the operation succeeds, the function returns true. The function prototype is as follows:

Bool _ fastcall RenameFile (const AnsiString OldName, const AnsiString NewName );

18. ChangeFileExt

Modify the extension of the specified file. The function prototype is as follows:

AnsiString _ fastcall ChangeFileExt (const AnsiString FileName, const AnsiString Extension );

19. ExtractFilePath

Returns the working path of the specified file. The function prototype is as follows:

AnsiString _ fastcall ExtractFilePath (const AnsiString FileName );

20. ExtractFileDir

Returns the working directory of the specified file. The function prototype is as follows:

AnsiString _ fastcall ExtractFileDir (const AnsiString FileName );

21. ExtractFileDrive

Returns the drive of the specified file. The function prototype is as follows:

AnsiString _ fastcall ExtractFileDrive (const AnsiString FileName );

22. ExtractFileName

Returns the name and extension of the specified file. The function prototype is as follows:

AnsiString _ fastcall ExtractFileName (const AnsiString FileName );

23. ExtractFileExt

Returns the extension of the specified file. The function prototype is as follows:

AnsiString _ fastcall ExtractFileExt (const AnsiString FileName );

Iii. Borland C ++ Builder VCL disk management functions

1. DiskFree

Returns the remaining space of the specified disk. If the operation succeeds, returns the remaining disk space. If the operation fails,-1 is returned. The function prototype is as follows:

Int _ fastcall DiskFree (Byte Drive );

2. DiskSize

Return the space of the specified disk. If the operation succeeds, return the disk space. If the operation fails, return-1. The function prototype is as follows:

Int _ fastcall DiskSize (Byte Drive );

3. GetCurrentDir

Return to the current working directory. The function prototype is as follows:

AnsiString _ fastcall GetCurrentDir ();

4. SetCurrentDir

Set the current working directory. If the operation is successful, the system returns true. The function prototype is as follows:

Bool _ fastcall SetCurrentDir (const AnsiString Dir );

5. CreateDir

Create a new directory. If the operation is successful, true is returned. Otherwise, false is returned. The function prototype is as follows:

Bool _ fastcall CreateDir (const AnsiString Dir );

6. RemoveDir

Delete the specified directory. If the operation is successful, the system returns true. Otherwise, the system returns false. The function prototype is as follows:

Bool _ fastcall RemoveDir (const AnsiString Dir );

Iv. Borland C ++ Builder VCL string functions

1. UpperCase

Converts a specified AnsiString to an uppercase string. The function prototype is as follows:

AnsiString _ fastcall UpperCase (const AnsiString S );

2. LowerCase

Converts the specified AnsiString string to lowercase. The function prototype is as follows:

AnsiString _ fastcall LowerCase (const AnsiString S );

3. CompareStr

Compare two AnsiString strings. The function prototype is as follows:

Int _ fastcall CompareStr (const AnsiString S1, const AnsiString S2 );

4. CompareText

Compare two AnsiString strings. The function prototype is as follows:

Int _ fastcall CompareText (const AnsiString S1, const AnsiString S2 );

5. StrLen

Returns the string length. The function prototype is as follows:

Cardinal _ fastcall StrLen (const char * Str );

6. StrEnd

Returns the pointer to the end of a string. The function prototype is as follows:

Char * _ fastcall StrEnd (const char * Str );

7. StrMove

Copy a specified number of characters from the source string to the target string. The function prototype is as follows:

Char * _ fastcall StrMove (char * Dest, const char * Source, Cardinal Count );

8. StrCopy

Copy the source string to the target string. The function prototype is as follows:

Char * _ fastcall StrCopy (char * Dest, const char * Source );

9. StrECopy

Copy the source string to the destination string and return the pointer to the end of the destination string. The function prototype is as follows:

Char * _ fastcall StrECopy (char * Dest, const char * Source );

10. StrLCopy

Copy the specified number of characters in the source string to the destination string and return the destination string pointer. The function prototype is as follows:

Char * _ fastcall StrLCopy (char * Dest, const char * Source, Cardinal MaxLen );

11. StrPCopy

Copy the source string of the AnsiString type to the destination string and return the destination string pointer. The function prototype is as follows:

Char * _ fastcall StrPCopy (char * Dest, const AnsiString Source );

12. StrPLCopy

Copy a specified number of characters from the source string (AnsiString type) to the destination string and return the destination string.

Pointer. The function prototype is as follows:

Char * _ fastcall StrPLCopy (char * Dest, const AnsiString Source, Cardinal MaxLen );

13. StrCat

Connect two strings and return the destination string pointer. The function prototype is as follows:

Char * _ fastcall StrCat (char * Dest, const char * Source );

14. StrLCat

Connect a specified number of source strings to the destination string and return the destination string pointer. The function prototype is as follows:

Char * _ fastcall StrLCat (char * Dest, const char * Source, Cardinal MaxLen );

15. StrComp

When two strings are compared, the comparison result is returned. The function prototype is as follows:

Int _ fastcall StrComp (const char * Str1, const char * Str2 );

16. StrIComp

The two strings are compared (case-insensitive) and the comparison result is returned. The function prototype is as follows:

Int _ fastcall StrIComp (const char * Str1, const char * Str2 );

17. StrLComp

Compare two strings with a specified number of characters. The function prototype is as follows:

Int _ fastcall StrLComp (const char * Str1, const char * Str2, Cardinal MaxLen );

18. StrScan

Search for specific characters in the specified string and return the pointer of the First Specific Character in the string. The function prototype is as follows:

Char * _ fastcall StrScan (const char * Str, char Chr );

19. StrRScan

Search for specific characters in the specified string and return the pointer of the last specific character in the string. The function prototype is as follows:

Char * _ fastcall StrRScan (const char * Str, char Chr );

20. StrPos

Search for the substring specified by Str2 in the string specified by Strl, and return the pointer to the first substring of Str2 in Str2. The function prototype is as follows:

Char * _ fastcall StrPos (const char * Str1, const char * Str2 );

21. StrUpper

Converts a string to uppercase. The function prototype is as follows:

Char * _ fastcall StrUpper (char * Str );

22. StrLower

Converts a string to lowercase. The function prototype is as follows:

Char * _ fastcall StrLower (char * Str );

23. StrPas

Converts a specified string to an AnsiString. The function prototype is as follows:

AnsiString _ fastcall StrPas (const char * Str );

24. StrAlloc

Allocate the specified bytes of memory to the string and return the memory pointer. The function prototype is as follows:

Char * _ fastcall StrAlloc (Cardinal Size );

25. StrBufSize

Returns the memory size pointed to by * Str. The function prototype is as follows:

Cardinal _ fastcall StrBufSize (const char * Str );

26. StrNew

Allocate space for the specified string in the heap and copy the string to the space. The function prototype is as follows:

Char * _ fastcall StrNew (const char * Str );

V. Borland C ++ Builder VCL numeric Conversion Function

1. IntToStr

Converts an integer to an AnsiString. The function prototype is as follows:

AnsiString _ fastcall IntToStr (int Value );

2. IntToHex

Converts an integer to a hexadecimal string. The function prototype is as follows:

AnsiString _ fastcall IntToHex (int Value, int Digits );

3. StrToInt

The AnsiString is converted to an integer. If the AnsiString cannot be converted, an EConvertError exception occurs,

The function prototype is as follows:

Int _ fastcall StrToInt (const AnsiString S );

4. StrToIntDef

Converts an AnsiString string to a numeric value. The function prototype is as follows:

Int _ fastcall StrToIntDef (const System: AnsiString S, int Default );

5. FloatToStr

Converts a floating point number to an AnsiString. The function prototype is as follows:

AnsiString _ fastcall FloatToStr (Extended Value );

6. StrToFloat

Converts an AnsiString string to a floating point value. The function prototype is as follows:

Extended _ fastcall StrToFloat (const AnsiString S );

7. FloatToStrF

Converts a floating point number to an AnsiString in the specified format. The function prototype is as follows:

AnsiString _ fastcall FloatToStrF (Extended Value, TFloatFormat Format, int Precision, int Digits );

Vi. Borland C ++ Builder VCL Time Functions

1. Date

The returned TDateTime object contains the current year, month, and day information. The function prototype is as follows:

System: TDateTime _ fastcall Date (void );

2. Time

The returned TDateTime object contains the current time information. The function prototype is as follows:

System: TDateTime _ fastcall Time (void );

3. Now

Returns the TDateTime object to obtain the current date and time information. The function prototype is as follows:

System: TDateTime _ fastcall Now (void );

4. DatetimeToString

Converts a TDateTime object to a string object in the specified format. The function prototype is as follows:

Void _ fastcall DateTimeToString (AnsiString &; Result, const AnsiString Format, System: TDateTime DateTime );

5. DateToStr

Convert the TDateTime object (including the current year, month, and day information) to a string object. The function prototype is as follows:

AnsiString _ fastcall DateToStr (System: TDateTime Date );

6. TimeToStr

Converts the current date to a string object. The function prototype is as follows:

AnsiString _ fastcall TimeToStr (System: TDateTime Time );

7. DateTimetoStr

Convert a TDateTime object to a string object. The function prototype is as follows:

AnsiString _ fastcall DateTimeToStr (System: TDateTime DateTime );

8. StrToDate

Converts a String object to a year, month, or day object. The function prototype is as follows:

System: TDateTime _ fastcall StrToDate (const AnsiString S );

9. StrToTime

Converts a String object to a time object. The function prototype is as follows:

System: TDateTime _ fastcall StrToTime (const AnsiString S );

10. StrToDateTime

Converts a String object to an object of year, month, day, and time. The function prototype is as follows:

System: TDateTime _ fastcall StrToDateTime (const AnsiString S );

11. DateTimeToSystemTime

Convert the TDateTime object to the operating system time. The function prototype is as follows:

Void _ fastcall DateTimeToSystemTime (System: TDateTime DateTime, _ SYSTEMTIME &; SystemTime );

12. SystemTimeToDateTime

Convert the operating system time to a TDateTime object. The function prototype is as follows:

System: TDateTime _ fastcall SystemTimeToDateTime (const _ SYSTEMTIME &; SystemTime );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.