🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14176

FileTimeToSystemTime

#14176
From: Larry Johnson
Date: Wed, 03 Sep 2003 11:11
31 lines
1998 bytes
I am trying to get a file time and look at it using FileTimeToSystemTime.
This requires three APIs, CreateFile, GetFileTime and FileTimeToSystemTime.
I am using the code below to do this. The file TimeTest.txt is a simple text
file in the same folder as the exe. The numbers in the lpSystemTime
structure of the FileTimeToSystemTime API are junk numbers and I am not sure
why. Do you see any problems with my code.

Thanks
Larry.

================================================
#include <windows.h>
#include <winbase.h>

  bool result;
  FILETIME ftCreate, ftAccess, ftWrite;
  HANDLE hFile;
  SYSTEMTIME lpSystemTime;
  LPCTSTR FileName;

  FileName = "TimeTest.txt";

  hFile = CreateFile( FileName,
                      GENERIC_READ | GENERIC_WRITE,
                      0, NULL, OPEN_ALWAYS,
                      FILE_ATTRIBUTE_NORMAL, NULL );

  result= GetFileTime( hFile, &ftCreate, &ftAccess, &ftWrite );

  result= FileTimeToSystemTime( &ftWrite, &lpSystemTime );
================================================
Technical Details
Message-ID: <3f55cc76@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7905adfcdd54cb3c,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-03 04:16:00 PST
Reply-To: "Larry Johnson" <johnson22@ev1.net>
From: "Larry Johnson" <johnson22@ev1.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: FileTimeToSystemTime
Date: Wed, 3 Sep 2003 06:11:58 -0500
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 216.40.192.32
Message-ID: <3f55cc76@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1062587510 216.40.192.32 (3 Sep 2003 04:11:50 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail