Description of VCL functions commonly used in Bcb/delphi (file functions)

Source: Internet
Author: User
Tags function prototype

--------------------
file Operations
--------------------
Function Name: Changefileext
Function Description: Change the extension of the specified file, the function prototype is as follows:
ansistring __fastcall changefileext (const ansistring filename,const ansistring Extension);

Function Name: DeleteFile
Function Description: Delete the specified file on the computer disk, and if the operation succeeds, the function returns True and the function prototype is as follows:
BOOL __fastcall deletefile (const ansistring FileName);

Function Name: Extractfiledir
Function Description: Returns the working directory of the specified file, the function prototype is as follows:
ansistring __fastcall extractfiledir (const ansistring FileName);

Function Name: extractfiledrive
Function Description: Returns the drive of the specified file, the function prototype is as follows:
ansistring __fastcall extractfiledrive (const ansistring FileName);

Function Name: Extractfileext
Function Description: Returns the extension of the specified file, the function prototype is as follows:
ansistring __fastcall extractfileext (const ansistring FileName);

Function Name: Extractfilename
Function Description: Returns the filename and extension of the specified file, the function prototype is as follows:
ansistring __fastcall extractfilename (const ansistring FileName);

Function Name: Extractfilepath
Function Description: Returns the working path of the specified file, the function prototype is as follows:
ansistring __fastcall extractfilepath (const ansistring FileName);

Function Name: fileage
Function Description: Returns the time label of the specified file and, if the operation fails, returns 1, the function prototype is as follows:
int __fastcall fileage (const system::ansistring FileName);

Function Name: FileClose
Function Description: Close the specified file, the function prototype is as follows:
void __fastcall fileclose (int Handle);

Function Name: filecreate
Function Description: Creates a new file with the specified file name, if returned as a positive number, indicates that the operation succeeded, the return value is a file handle, and if the return value is-1, the operation failed. The function prototype is as follows:
int __fastcall filecreate (const System:: ansistring FileName);

Function Name: fileexists
Function Description: Used to test whether the specified file exists, if there is a return true, otherwise false, the function prototype is as follows:
BOOL __fastcall fileexists (const system::ansistring FileName);

Function Name: filegetattr
Function Description: Returns the properties of the specified file, and if the operation fails, the function returns-1, the function prototype is as follows;
int __fastcall filegetattr (const system::ansistring FileName);

Function Name: filegetdate
Function Description: Returns the DOS time label of the specified file, and if the operation fails, it is nearly 1 and the function prototype is as follows:
int __fastcall filegetdate (int Handle);

Function Name: FileOpen
Function Description: Open the specified file, if returned as a positive number, indicating that the operation succeeded, the return value is a file handle: If the return value is-1, the operation failed, the function prototype is as follows:
int __fastcall FileOpen (const system::ansistring filename,int Mode);

Function Name: FileRead
Function Description: Reads the specified byte of data from the file into the buffer, the function returns the actual number of bytes read, the function prototype is as follows;
int __fastcall FileRead (int handle,void *buffer,int Count);

Function Name: FileSeek
Function Description: Adjust the file pointer to a new location, if the operation succeeds, return the new file location, if the operation fails, the function returns 1, the function prototype is as follows:
int __fastcall FileSeek (int handle,int offset,int Origin);

Function Name: filesetattr
Function Description: Change the attribute parameter of the specified file, if the operation succeeds, return 0, the function prototype is as follows;
int __fastcall filesetattr (const system::ansistring filename,int Attr);

Function Name: filesetdate
Function Description: Change the DOS time label of the specified file, if the operation succeeds, return 0, otherwise the error code, the function prototype is as follows:
int __fastcall filesetdate (int handle,int age);

Function Name: FileWrite
Function Description: Writes the data of the buffer to the current location of the specified file if the operation succeeds, the function returns the number of bytes actually written, and if returned as-1, the operation produces an error and the function prototype is as follows:
int __fastcall FileWrite (int handle,const void *buffer,int Count);

Function Name: FindClose
Function Description: Releases the memory resource requested by the FindFirst operation, the function prototype is as follows:
void __fastcall FindClose (Tsearchrec &f);

Function Name: FindFirst
Function Description: In the specified file directory, search for a file matching the specific attribute parameters, if the successful search to find a qualifying 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);

Function Name: FindNext
Function Description: Continue to search for the file specified by the FindFirst attribute parameter, if the successful search finds the matching file, then the function returns 0, otherwise the function returns an error code, the function prototype is as follows:
int __fastcall FindNext (Tsearchrec &f);

Function Name: RenameFile
Function Description: Change the name of the specified file, and if the operation succeeds, the function returns True and the function prototype is as follows:
BOOL __fastcall renamefile (const ansistring oldname, const ansistring NewName);

--------------------
Disk Directory Management
--------------------
Function Name: Createdir
Function Description: Create a new directory, if the operation succeeds, return True, otherwise return false, function prototype as follows:
BOOL __fastcall createdir (const ansistring Dir);

Function Name: diskfree
Function Description: Returns the remaining space on the specified disk, returns the remaining disk space if the operation succeeds, returns 1 if the operation fails, and the function prototype is as follows:
int __fastcall diskfree (Byte Drive);

Function Name: disksize
Function Description: Returns the space of the specified disk if the operation succeeds, returns disk space, or 1 if the operation fails, and the function prototype is as follows:
int __fastcall disksize (Byte Drive);

Function Name: Getcurrentdir
Function Description: Returns the current working directory, the function prototype is as follows:
Ansistring __fastcall Getcurrentdir ();

Function Name: RemoveDir
Function Description: Delete The specified directory, if the operation succeeds, return True, otherwise return false, function prototype as follows:
BOOL __fastcall removedir (const ansistring Dir);

Function Name: Setcurrentdir
Function Description: Sets the current working directory, if the operation succeeds, returns TRUE, the function prototype is as follows:
BOOL __fastcall setcurrentdir (const ansistring Dir);

http://www.ccrun.com/article.asp?i=983&d=22l01d

Description of VCL functions commonly used in Bcb/delphi (file functions)

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.