LoginSignup
0
1

More than 5 years have passed since last update.

C++ Builder 10.2 Tokyo > datetime > FileAge() > W8111 非推奨のエンティティ '_fastcall FileAge(const UnicodeString)' にアクセスしている

Posted at
動作環境
Rad Studio 10.2 Tokyo Update 2

関連: c++ builder XE4 / datetime > ファイルの日時を取得する > FileAge()+FileDateToDateTime() / TFile::GetLastWriteTime()

メモ: FileAge の最初のオーバーロードは、廃止予定です。 代わりに FileAge の 2 つ目のオーバーロードを使用してください。

Unit1.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    String filepath = L"test.txt";

    // 1つ目のオーバーロード
    int fileAge = FileAge(filepath);
    TDateTime filedt1 = FileDateToDateTime(fileAge);

    // 2つ目のオーバーロード
    TDateTime filedt2;
    bool res = FileAge(filepath, filedt2, /*FollowLink=*/true);
}
//---------------------------------------------------------------------------

1つ目のオーバーロードは廃止予定なので、2つ目を使う方がいいとのこと。

実際に実行したところ、2つの取得により秒の値に違いはある。

qiita.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1