C ++ builder VCL library function introduction (1) Select blog from extcsdn

Source: Internet
Author: User
Introduction to C ++ builder VCL library functions (1)Select blog from extcsdn
Keywords Introduction to C ++ builder VCL library functions (1)
Source

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, an error is returned.CodeThe 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 );

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.