Memory management functions for BCB-VCL

Source: Internet
Author: User
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 and the return value is the file handle.

: 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
Creates a new file with the specified file name. If a positive number is returned, the operation is successful.

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
Reads data of the specified byte from the file to the buffer, and the function returns the actually read byte

Number. 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 is successful

Number of bytes actually written. If-1 is returned, the operation produces an error. function prototype

As follows:
Int _ fastcall filewrite (INT handle, const void * buffer, int

Count );

5. FileSeek
Adjust the file pointer to a new location. If the operation is successful, the new file location is returned. If

If the operation fails,-1 is returned. 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 specified file exists, the system returns true. Otherwise, the system returns false.

Type:
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.

Code. 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
In the specified file directory, search for files that meet the specified attribute parameters.

To a qualified file,
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 searching for the file with the attribute parameter specified by findfirst.

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
Deletes a specified file from a computer disk. If the operation succeeds, the function returns true.

The 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 disk space. If the operation succeeds, the system returns the remaining disk space.

-1 is returned if this operation fails. The function prototype is as follows:
Int _ fastcall diskfree (byte drive );

2. disksize
Returns the space of the specified disk. If the operation succeeds, the disk space is returned. If the operation fails

-1 is returned. 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. function prototype
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 conversion fails, an econverterror exception is generated. 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.