Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to read latest text file created.the file name is not constant(i. hours, minuets is changing in file name),for example filename-1449,some filename-1450(i.e,14 hr,50 min).
is it possible to read from latest modified time.
can any one help me how is it possible.
Posted
Updated 8-Dec-11 22:19pm
v3
Comments
Resmi Anna 9-Dec-11 4:11am    
Is it any folder specific?Or latest of all files in the system?
anil03006 9-Dec-11 4:31am    
in a folder latest files.

You can do this by reading the last modified date of the file attribute. Suppose under one directory you are storing the file then read last modified date of selected file one by one here you can also use filter if you are interested in specific type of file and at the end copmparing last modified read file. you can find out the latest file. :)
 
Share this answer
 
you can use the class CFileFind. you can loop through each files in the folder using the FindNextFile() function of this class and can find the creation time or modification time of the files using GetCreationTime() and GetLastWriteTime(). Then compare to find the latest time
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900