|
Borland C++ Builder可视化构件库(VCL)的常用函数
|
|
--学习笔记
|
一、内存管理函数
1. void *_FastCall AllocMem(Cardinal Size)
分配指定字节的内存块,并将分配的每一个字节初始化为0。
2. int _FastCall SysFreeMem(void *P)
释放所指定的内存块。
3. void *_FastCall SysReallocMem(void *P,int Size)
重新分配参数Size所指定的内存。
二、文件操作函数
1. int _FastCall FileOpen(const System::AnsiString FileName,int Mode)
打开文件。返回正数(文件句柄)表示操作成功;返回-1表示失败。
2. int _FastCall FileCreate(const System::AnsiString FileName)
创建一个新文件。返回正数(文件句柄)表示操作成功;返回-1表示失败。
3. int _FastCall FileRead(int Handle,void *Buffer,int Count)
从文件中读取指定字节的数据到缓冲区中,返回实际读取的字节数。
4. int _FastCall FileWrite(int Handle,const void *Buffer,int Count)
将缓冲区中的数据写入到指定的文件当前位置中去。操作成功返回实际写入的字节数;失败返回-1。
5. int _FastCall FileSeek(int Handle,int Offset,int Origin)
调整文件指针到新的位置。成功则返回新的文件位置,失败则返回-1。
6. void _FastCall FileClose(int Handle)
关闭指定的文件。
8. bool _FastCall FileExists(const System::AnsiString FileName)
测试指定文件是否存在。存在返回真;否则返回假。
11.int _FastCall FileGetAttr(const System::AnsiString FileName)
返回指定文件的属性。失败则返回-1。
12.int _FastCall FileSetAttr(const System::AnsiString FileName,int Attr)
更改文件的属性,成功则返回0。
13.int _FastCall FindFirst(const System::AnsiString Path,int Attr,TSearchRec &F)
在指定的文件目录内,搜寻符合特定属性参数的文件。成功则返回0,否则返回错误代码。
14.int _FastCall FindNext(TSearchRec &F)
继续搜寻FindFiest所指定属性参数的文件。成功则返回0,否则返回错误代码。
struct TSearchRec
{
int Time;
int Size;
int Attr;
AnsiString Name;
int ExcludeAttr;
unsigned FindHandle;
_WIN32_FIND_DATAA FindData;
};
15.void _FastCall FindClose(TSearchRec &F)
释放FindFirst操作所申请的内存资源。
16.bool _FastCall DeleteFile(const System::AnsiString FileName)
删除指定的文件。成功则返回真。
17.bool _FastCall RenameFile(const System::AnsiString OldName,const System::AnsiString NewName)
更改指定文件的名称。成功则返回真。
18.System::AnsiString _FastCall ChangeFileExt(const System::AnsiString FileName,const System::AnsiString Extension)
更改指定文件的扩展名。
19.System::AnsiString _FastCall ExtractFilePath(const System::AnsiString FileName)
返回指定文件的工作路径。
20.System::AnsiString _FastCall ExtractFileDir(const System::AnsiString FileName)
返回指定文件的工作目录。
21.System::AnsiString _FastCall ExtractFileDrive(const System::AnsiString FileName)
返回指定文件的驱动器。
三、磁盘管理函数
1. int _FastCall DiskFree(Byte Drive)
返回指定磁盘的剩余空间。失败返回-1。
2. int _FastCall DiskSize(Byte Drive)
返回指定磁盘的空间。失败则返回-1。
3. System::AnsiString _FastCall GetCurrentDir(void)
返回当前工作目录。
4. bool _FastCall SetCurrentDir(const System::AnsiString Dir)
设置当前工作目录。成功则返回真。
5. bool _FastCall CreateDir(const System::AnsiString Dir)
创建新的目录,成功则返回真。
6. bool _FastCall RemoveDir(const System::AnsiString Dir)
删除指定的目录,成功则返回真。
四、字符串函数
5. Cardinal _FastCall StrLen(char *Str)
返回字符串的长度。
13.char * _FastCall StrCat(char *Dest,char *Source)
连接两个字符串,并返回目的字符串的指针。
14.char * _FastCall StrLCat(char *Dest,char *Source,Cardinal MaxLen)
将指定数目的源字符串连接到目的字符串,并返回目的字符串的指针。
15.int _FastCall StrComp(char *Str1,char *Str2)
两个字符串相互比较,返回比较的结果。
16.int _FastCall StrIComp(char *Str1,char *Str2)
两个字符串相互比较(不论大小写),返回比较的结果。
17.int _FastCall StrIComp(char *Str1,char *Str2,Cardinal MaxLen)
对两个字符串指定数目的字符进行比较操作。
18.char * _FastCall StrScan(char *Str,char Chr)
在指定的字符串中寻找特定的字符,并返回字符串中第一个特定字符的指针。
19.char * _FastCall StrRScan(char *Str,char Chr)
在指定的字符串中寻找特定的字符,并返回字符串中最后一个特定字符的指针。
24.char * _FastCall StrAlloc(Cardinal Size)
为字符串分配指定字节的内存,并返回内存指针。
25.Cardinal _FastCall StrBufSize(char *Str)
返回*Str所指向内存的大小。
26.char * _FastCall StrNew(char *Str)
在堆中为指定的字符串分配空间,并将字符串拷贝到此空间中。
五、数值转换函数
1. System::AnsiString _FastCall IntToStr(int Value)
将整数转换成AnsiString字符串。
2. System::AnsiString _FastCall IntToHex(int Value,int Digits)
将整数转换成16进制字符串。
3. int _FastCall StrToInt(const System::AnsiString S)
将AnsiString字符串转换成整数值,如果不能转换,则产生EConvertError异常。
5. System::AnsiString _FastCall FloatToStr(Extended Value)
将浮点数转换成AnsiString字符串。
6. Extended _FastCall StrToFloat(const System::AnsiString S)
将AnsiString字符串转换成一个浮点数。
7. System::AnsiString _FastCall FloatToStrF(Extended Value,TFloatFormat Format,int Precision,int Digits)
将浮点数转换成指定格式的AnsiString字符串。
|
| |
|