BORLAND C++常用VCL庫(kù)函數(shù)怎么樣

字號(hào):


    VCL庫(kù)函數(shù)簡(jiǎn)介
    一.BORLAND C++ BUILDER VCL的內(nèi)存管理函數(shù)
    1. AllocMem
    在隊(duì)中分配指定字節(jié)的內(nèi)存塊,并將分配的每一個(gè)字節(jié)初始化為 0.函數(shù)原型如下:
    void * __fastcall AllocMem(Cardinal Size);
    2. SysFreeMem
    釋放所指定的內(nèi)存塊.函數(shù)原型如下:
    int __fastcall SysFreeMem(void * P);
    3. SysReallocMem
    要求重新分配參數(shù)Size所指定的內(nèi)存.函數(shù)原型如下:
    void * __fastcall SysReallocMem(void * P , int Size);
    二.Borland C++ Builder VCL的文件操作函數(shù)
    1. FileOpen
    打開(kāi)指定的文件,如果返回為正數(shù),表示操作成功,返回值為文件句柄:如果返回值為-1,表示操作失敗,函數(shù)原型如下:
    int __fastcall FileOpen(const System::AnsiString FileName,int Mode);
    2. FileCreate
    以指定的文件名稱創(chuàng)建一個(gè)新的文件,如果返回為正數(shù),表示操作成功,返回值為文件句柄,如果返回值為-1,表示操作失敗.函數(shù)原型如下:
    int __fastcall FileCreate(const System ::AnsiString FileName);
    3. FileRead
    從文件中讀取指定字節(jié)的數(shù)據(jù)到緩沖區(qū)中,函數(shù)返回實(shí)際讀取的字節(jié)數(shù),函數(shù)原型如下;
    int __fastcall FileRead(int Handle,void *Buffer,int Count);
    4. FileWrite
    將緩沖區(qū)的數(shù)據(jù)寫(xiě)入到指定的文件的當(dāng)前位置中去如果操作成功,函數(shù)返回實(shí)際寫(xiě)入的字節(jié)數(shù),如果返回為-1,則表示操作產(chǎn)生錯(cuò)誤,函數(shù)原型如下:
    int __fastcall FileWrite(int Handle,const void *Buffer,int Count);
    5. FileSeek
    調(diào)整文件指針到新的位置,如果操作成功,則返回新的文件位置,如果操作失敗,則函數(shù)返回-1,函數(shù)原型如下:
    int __fastcall FileSeek(int Handle,int Offset,int Origin);
    6. FileClose
    關(guān)閉指定的文件,函數(shù)原型如下:
    void __fastcall FileClose(int Handle);
    7. FileAge
    返回指定文件的時(shí)間標(biāo)簽,如果操作失敗,則返回-1,函數(shù)原型如下:
    int __fastcall FileAge(const System::AnsiString FileName);
    8. FileExists
    用于測(cè)試指定的文件是否存在,如果存在返回真,否則返回假,函數(shù)原型如下:
    bool __fastcall FileExists(const System::AnsiString FileName);
    9. FileGetDate
    返回指定文件的DOS時(shí)間標(biāo)簽,如果操作失敗,則近回-1,函數(shù)原型如下:
    int __fastcall FileGetDate(int Handle);
    10.FileSetDate
    更改指定文件的DOS時(shí)間標(biāo)簽,如果操作成功,返回0,否則返回錯(cuò)誤代碼,函數(shù)原型如下:
    int __fastcall FileSetDate(int Handle,int Age);
    11.FileGetAttr
    返回指定文件的屬性,如果操作失敗,則函數(shù)返回-1,函數(shù)原型如下;
    int __fastcall FileGetAttr(const System::AnsiString FileName);
    12.FileSetAttr
    更改指定文件的屬性參數(shù),如果操作成功,則返回0,函數(shù)原型如下;
    int __fastcall FileSetAttr(const System::AnsiString FileName,int Attr);
    13.FindFirst
    在指定的文件目錄內(nèi),搜尋符合特定屬性參數(shù)的文件,如果成功地查找到符合條件的文件,
    則函數(shù)返回0,否則函數(shù)返回一個(gè)錯(cuò)誤代碼,函數(shù)原型如下:
    int __fastcall FindFirst(const System::AnsiString Path,int Attr,TSearchRec &;F);
    14.FindNext
    繼續(xù)搜尋FindFirst所指定屬性參數(shù)的文件,如果成功地查找到符合條件的文件,則函數(shù)返回0,否則函數(shù)返回一個(gè)錯(cuò)誤代碼,函數(shù)原型如下:
    int __fastcall FindNext(TSearchRec &;F);
    15.FindClose
    釋放FindFirst操作所申請(qǐng)的內(nèi)存資源,函數(shù)原型如下:
    void __fastcall FindClose(TSearchRec &;F);
    16.DeleteFile
    在計(jì)算機(jī)磁盤(pán)中刪除指定的文件,如果操作成功,則函數(shù)返回真,函數(shù)原型如下:
    bool __fastcall DeleteFile(const AnsiString FileName);
    17.RenameFile
    更改指定文件的名稱,如果操作成功,則函數(shù)返回真,函數(shù)原型如下:
    bool __fastcall RenameFile(const AnsiString OldName, const AnsiString NewName);
    18.ChangeFileExt
    更改指定文件的擴(kuò)展名,函數(shù)原型如下:
    AnsiString __fastcall ChangeFileExt(const AnsiString FileName,const AnsiString Extension);
    19.ExtractFilePath
    返回指定文件的工作路徑,函數(shù)原型如下:
    AnsiString __fastcall ExtractFilePath(const AnsiString FileName);
    20.ExtractFileDir
    返回指定文件的工作目錄,函數(shù)原型如下:
    AnsiString __fastcall ExtractFileDir(const AnsiString FileName);
    21.ExtractFileDrive
    返回指定文件的驅(qū)動(dòng)器,函數(shù)原型如下:
    AnsiString __fastcall ExtractFileDrive(const AnsiString FileName);
    22.ExtractFileName
    返回指定文件的文件名及擴(kuò)展名,函數(shù)原型如下:
    AnsiString __fastcall ExtractFileName(const AnsiString FileName);
    23.ExtractFileExt
    返回指定文件的擴(kuò)展名,函數(shù)原型如下:
    AnsiString __fastcall ExtractFileExt(const AnsiString FileName);
    三. Borland C++ Builder VCL的磁盤(pán)管理函數(shù)
    1. DiskFree
    返回指定磁盤(pán)的剩余空間,如果操作成功,返回剩余磁盤(pán)空間,如果操作失敗,則返回-1,函數(shù)原型如下:
    int __fastcall DiskFree(Byte Drive);
    2. DiskSize
    返回指定磁盤(pán)的空間,如果操作成功,返回磁盤(pán)空間,如果操作失敗,則返回-1,函數(shù)原型如下:
    int __fastcall DiskSize(Byte Drive);
    3. GetCurrentDir
    返回當(dāng)前工作目錄,函數(shù)原型如下:
    AnsiString __fastcall GetCurrentDir();
    4. SetCurrentDir
    設(shè)置當(dāng)前工作目錄,如果操作成功,則返回真,函數(shù)原型如下:
    bool __fastcall SetCurrentDir(const AnsiString Dir);
    5. CreateDir
    創(chuàng)建新的目錄,如果操作成功,返回真,否則返回假,函數(shù)原型如下:
    bool __fastcall CreateDir(const AnsiString Dir);
    6. RemoveDir
    刪除指定的目錄,如果操作成功,返回真,否則返回假,函數(shù)原型如下:
    bool __fastcall RemoveDir(const AnsiString Dir);
    四. Borland C++ Builder VCL的字符串函數(shù)
    1. UpperCase
    將指定的AnsiString字符串轉(zhuǎn)換為大寫(xiě)形式,函數(shù)原型如下:
    AnsiString __fastcall UpperCase(const AnsiString S);
    2. LowerCase
    將指定的AnsiString字符串轉(zhuǎn)換為小寫(xiě)形式,函數(shù)原型如下:
    AnsiString __fastcall LowerCase(const AnsiString S);
    3. CompareStr
    比較兩個(gè)AnsiString字符串,函數(shù)原型如下:
    int __fastcall CompareStr(const AnsiString S1, const AnsiString S2);
    4. CompareText
    比較兩個(gè)AnsiString字符串,函數(shù)原型如下:
    int __fastcall CompareText(const AnsiString S1, const AnsiString S2);
    5. StrLen
    返回字符串的長(zhǎng)度,函數(shù)原型如下:
    Cardinal __fastcall StrLen(const char * Str);
    6. StrEnd
    返回字符串結(jié)尾指針,函數(shù)原型如下:
    char * __fastcall StrEnd(const char * Str);
    7. StrMove
    從源字符串向目的字符串拷貝指定數(shù)目的字符,函數(shù)原型如下:
    char * __fastcall StrMove(char * Dest, const char * Source, Cardinal Count);
    8. StrCopy
    將源字符串拷貝到目的字符串中,函數(shù)原型如下:
    char * __fastcall StrCopy(char * Dest, const char * Source);
    9. StrECopy
    將源字符串拷貝到目的字符串中,并返回目的字符串結(jié)尾指針,函數(shù)原型如下:
    char * __fastcall StrECopy(char * Dest, const char * Source);
    10.StrLCopy
    將源字符串指定數(shù)目的字符拷貝到目的字符串中,并返回目的字符串指針,函數(shù)原型如下:
    char * __fastcall StrLCopy(char * Dest, const char * Source, Cardinal MaxLen);
    11.StrPCopy
    將AnsiString類型的源字符串拷貝到目的字符串中,并返回目的字符串指針,函數(shù)原型如下:
    char * __fastcall StrPCopy(char * Dest, const AnsiString Source);
    12.StrPLCopy
    將源字符串(AnsiString類型)指定數(shù)目的字符拷貝到目的字符串中,并返回目的字符串
    指針,函數(shù)原型如下:
    char * __fastcall StrPLCopy(char * Dest, const AnsiString Source, Cardinal MaxLen);
    13.StrCat
    連接兩個(gè)字符串,并返回目的字符串指針,函數(shù)原型如下:
    char * __fastcall StrCat(char * Dest, const char * Source);
    14.StrLCat
    將指定數(shù)目的源字符串連接到目的字符串,并返回目的字符串指針,函數(shù)原型如下:
    char * __fastcall StrLCat(char * Dest, const char * Source, Cardinal MaxLen);
    15.StrComp
    兩個(gè)字符串相到比較,返回比較的結(jié)果,函數(shù)原型如下:
    int __fastcall StrComp(const char * Str1, const char * Str2);
    16.StrIComp
    兩個(gè)字符串相互比較(不論大小寫(xiě)),返回比較的結(jié)果,函數(shù)原型如下:
    int __fastcall StrIComp(const char * Str1, const char * Str2);
    17.StrLComp
    對(duì)兩個(gè)字符串指定數(shù)目的字符進(jìn)行比較操作,函數(shù)原型如下:
    int __fastcall StrLComp(const char * Str1, const char * Str2, Cardinal MaxLen);
    18.StrScan
    在指定的字符串中尋找特定的字符,并返回字符串中第一個(gè)特定字符的指針,函數(shù)原型如下:
    char * __fastcall StrScan(const char * Str, char Chr);
    19.StrRScan
    在指定的字符串中尋找特定的字符,并返回字符串中最后一個(gè)特定字符的指針,函數(shù)原型如下:
    char * __fastcall StrRScan(const char * Str, char Chr);
    20.StrPos
    在Strl所指定的字符串中尋找Str2所指定的子字符串,并返回Str2在Str2中第一個(gè)子字符的指針,函數(shù)原型如下:
    char * __fastcall StrPos(const char * Str1, const char * Str2);
    21.StrUpper
    將字符串轉(zhuǎn)換為大寫(xiě)形式,函數(shù)原型如下:
    char * __fastcall StrUpper(char * Str);
    22.StrLower
    將字符串轉(zhuǎn)換為小寫(xiě)形式,函數(shù)原型如下:
    char * __fastcall StrLower(char * Str);
    23.StrPas
    將指定的字符串轉(zhuǎn)換為AnsiString類型字符串對(duì)象,函數(shù)原型如下:
    AnsiString __fastcall StrPas(const char * Str);
    24.StrAlloc
    為字符串分配指定字節(jié)的內(nèi)存,并返回內(nèi)存指針,函數(shù)原型如下:
    char * __fastcall StrAlloc(Cardinal Size);
    25.StrBufSize
    返回*Str所指向內(nèi)存的大小,函數(shù)原型如下:
    Cardinal __fastcall StrBufSize(const char * Str);
    26.StrNew
    在堆中為指定字符串分配空間,并將字符串拷貝到此空間中,函數(shù)原型如下:
    char * __fastcall StrNew(const char * Str);
    五. Borland C++ Builder VCL的數(shù)值轉(zhuǎn)換函數(shù)
    1. IntToStr
    將整數(shù)轉(zhuǎn)換為AnsiString字符串,函數(shù)原型如下:
    AnsiString __fastcall IntToStr(int Value);
    2. IntToHex
    將整數(shù)轉(zhuǎn)換為十六進(jìn)制字符串,函數(shù)原型如下:
    AnsiString __fastcall IntToHex(int Value, int Digits);
    3. StrToInt
    將AnsiString字符串轉(zhuǎn)換為整數(shù)值,如果不能進(jìn)行轉(zhuǎn)換,則產(chǎn)生EConvertError異常,
    函數(shù)原型如下:
    int __fastcall StrToInt(const AnsiString S);
    4. StrToIntDef
    將AnsiString字符串轉(zhuǎn)換為一個(gè)數(shù)值,函數(shù)原型如下:
    int __fastcall StrToIntDef(const System::AnsiString S,int Default);
    5. FloatToStr
    將浮點(diǎn)數(shù)轉(zhuǎn)換為AnsiString字符串,函數(shù)原型如下:
    AnsiString __fastcall FloatToStr(Extended Value);
    6. StrToFloat
    將AnsiString字符串轉(zhuǎn)換為一個(gè)浮點(diǎn)數(shù)值,函數(shù)原型如下:
    Extended __fastcall StrToFloat(const AnsiString S);
    7. FloatToStrF
    將浮點(diǎn)數(shù)轉(zhuǎn)換為指定格式的AnsiString字符串,函數(shù)原型如下:
    AnsiString __fastcall FloatToStrF(Extended Value, TFloatFormat Format,int Precision, int Digits);
    六. Borland C++ Builder VCL的時(shí)間函數(shù)
    1. Date
    返回TDateTime對(duì)象,包含當(dāng)前的年月日信息,函數(shù)原型如下:
    System::TDateTime __fastcall Date(void);
    2. Time
    返回TDateTime對(duì)象,包含當(dāng)前的時(shí)間信息,函數(shù)原型如下:
    System::TDateTime __fastcall Time(void);
    3. Now
    返回TDateTime對(duì)象,獲取當(dāng)前的日期和時(shí)間信息,函數(shù)原型如下:
    System::TDateTime __fastcall Now(void);
    4. DatetimeToString
    將TDateTime對(duì)象轉(zhuǎn)換為指定格式的字符串對(duì)象,函數(shù)原型如下:
    void __fastcall DateTimeToString(AnsiString &;Result, const AnsiString Format,System::TDateTime DateTime);
    5. DateToStr
    將TDateTime對(duì)象(包含當(dāng)前年月日信息)轉(zhuǎn)換為字符串對(duì)象,函數(shù)原型如下:
    AnsiString __fastcall DateToStr(System::TDateTime Date);
    6. TimeToStr
    將當(dāng)前日期轉(zhuǎn)換為字符串對(duì)象,函數(shù)原型如下:
    AnsiString __fastcall TimeToStr(System::TDateTime Time);
    7. DateTimetoStr
    將TDateTime對(duì)象轉(zhuǎn)換為字符串對(duì)象,函數(shù)原型如下:
    AnsiString __fastcall DateTimeToStr(System::TDateTime DateTime);
    8. StrToDate
    將字符串對(duì)象轉(zhuǎn)換為年月日對(duì)象,函數(shù)原型如下:
    System::TDateTime __fastcall StrToDate(const AnsiString S);
    9. StrToTime
    將字符串對(duì)象轉(zhuǎn)換時(shí)間對(duì)象,函數(shù)原型如下:
    System::TDateTime __fastcall StrToTime(const AnsiString S);
    10.StrToDateTime
    將字符串對(duì)象轉(zhuǎn)換為年月日時(shí)間對(duì)象,函數(shù)原型如下:
    System::TDateTime __fastcall StrToDateTime(const AnsiString S);
    11.DateTimeToSystemTime
    將TDateTime對(duì)象轉(zhuǎn)換為操作系統(tǒng)時(shí)間,函數(shù)原型如下:
    void __fastcall DateTimeToSystemTime(System::TDateTime DateTime, _SYSTEMTIME &;SystemTime);
    12.SystemTimeToDateTime
    將操作系統(tǒng)時(shí)間轉(zhuǎn)換為T(mén)DateTime對(duì)象,函數(shù)原型如下:
    System::TDateTime __fastcall SystemTimeToDateTime(const _SYSTEMTIME &;SystemTime);