Solved

Finding date of a file in runtime

Posted on 2001-06-20
7
469 Views
Last Modified: 2013-12-26
I'm using PB 7.0 and would like to know how to find out the date and time of a file (*.txt/*.pbd) during runtime.  URGENT!!

Thank you,
Baskar
0
Comment
Question by:baskar
  • 4
  • 2
7 Comments
 

Author Comment

by:baskar
Comment Utility
pls mail to baskar@comline.com.my
0
 
LVL 4

Expert Comment

by:Bhatti
Comment Utility
If you saved your  *.txt file as "tab Separated"  file. Make a datastore from this file and you can access any time to your datastore.  (ImportFile function for *.Txt file). The count of your datastore columns must be equal to the *.txt file columns.
0
 

Author Comment

by:baskar
Comment Utility
Hi Bhatti,

No I won't be reading the file, I mean the contents. I just wants to know the last edited date and time of the file.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:baskar
Comment Utility
Hi Bhatti,

No I won't be reading the file, I mean the contents. I just wants to know the last edited date and time of the file.
0
 
LVL 4

Expert Comment

by:Bhatti
Comment Utility
Try with API/SDK functions to find data and time of file attributes.
0
 

Accepted Solution

by:
Miguel_Angel earned 100 total points
Comment Utility
If you have worked with API's before you wouldn't find any problems with that.

You need to use 2 API's:

BOOL GetFileTime(
  HANDLE hFile,                 // handle to file
  LPFILETIME lpCreationTime,    // creation time
  LPFILETIME lpLastAccessTime,  // last access time
  LPFILETIME lpLastWriteTime    // last write time
);

BOOL FileTimeToSystemTime(
  CONST FILETIME *lpFileTime,  // file time to convert
  LPSYSTEMTIME lpSystemTime    // receives system time
);
       
And for working with them you need this previus created structures:

st_filetime
     long v_lowdatetime
     long v_highdatetime
       
st_systemtime
     int v_year
     int v_month
     int v_dayofweek
     int v_day
     int v_hour
     int v_minute
     int v_second
     int v_millisecond
       
And the script would look like:

string filename
long   fileid

st_filetime   creationtime, lastaccesstime, lastwritetime
st_systemtime systemtime

filename = "c:\testfile.txt"
fileid   = fileopen(filename)

getfiletime(fileid, creationtime, lastaccesstime, lastwritetime)

filetimetosystemtime(creationtime, systemtime)

And voila, you have in systemtime.v_year, systemtime.v_month, and so on. Of course several error filters should help too, but this isbasically what you need to know.

Good luck.
0
 

Author Comment

by:baskar
Comment Utility
Thank you very much for your guidance. Sorry for the delay in getting back.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now