| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Retrieves file information for a single file.
FileStats( <cFileName> , ;
[@<cFileAttr>] , ;
[@<nFileSize>] , ;
[@<dCreateDate>], ;
[@<nCreateTime>], ;
[@<dChangeDate>], ;
[@<nChangeTime>] ) --> lSuccess
The return value is .T. (true) when the information on the file <cFileName> could be retrieved, otherwise .F. (false) is returned.
Function FileStats() retrieves statistical information about a single file. It is more efficient than the Directory() function which retrieves the same information for a group of files and stores them in an array. FileStats(), in contrast, allows for "picking" desired information about a single file by passing the according parameters by reference to the function.
| See also: | Directory(), FCreate(), HB_FSize() |
| Category: | File functions , Low level file functions , xHarbour extensions |
| Source: | rtl\filestat.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows how to retrieve statistical information about
// a single file, and how to convert the time values from Seconds
// to a hh:mm:ss time formatted string.
PROCEDURE Main
LOCAL cFileName := "FILESTATS.PRG"
LOCAL cFileAttr , nFileSize
LOCAL dCreateDate, nCreateTime
LOCAL dChangeDate, nChangeTime
? FileStats( cFileName, @cFileAttr , @nFileSize , ;
@dCreateDate, @nCreateTime, ;
@dChangeDate, @nChangeTime )
? "File statistiscs"
? "File Name :", cFileName
? "Attributes:", cFileAttr
? "File Size :", nFileSize
? "Created :", dCreateDate, TString( nCreateTime )
? "Changed :", dChangeDate, TSTring( nChangeTime )
RETURN
http://www.xHarbour.com