Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Most recent file in folder...

Status
Not open for further replies.

LiquidBinary

Programmer
Jul 27, 2001
148
US
Can someone paste some code that will allow me to find the most recent file in a directory? i.e. The one file with the most recent creation time. I would like to do this with the raw API and not MFC. I know there are some API calls that can accomplish this, but you all know how big the win32 API is. mlg400@blazemail.com
 
see thread205-117916 Ion Filipski
1c.bmp


filipski@excite.com
 
CFile::GetStatus
BOOL GetStatus( CFileStatus& rStatus ) const;

static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );

Return Value
TRUE if the status information for the specified file is successfully obtained; otherwise, FALSE.

Parameters
rStatus

A reference to a user-supplied CFileStatus structure that will receive the status information. The CFileStatus structure has the following fields:

CTime m_ctime The date and time the file was created.

CTime m_mtime The date and time the file was last modified.

CTime m_atime The date and time the file was last accessed for reading.

LONG m_size The logical size of the file in bytes, as reported by the DIR command.

BYTE m_attribute The attribute byte of the file.

char m_szFullName[_MAX_PATH] The absolute filename in the Windows character set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top