Untitled

 avatar
unknown
plain_text
a year ago
736 B
7
Indexable
#include <iostream>
#include <filesystem>
#include <chrono>
#include <ctime>

int main() {
    std::filesystem::path dosya_yolu = "dosya.txt";

    // Belirtilen tarihi oluştur
    std::tm zaman = {};
    zaman.tm_mday = 1; // gün
    zaman.tm_mon = 2 - 1; // ay
    zaman.tm_year = 22 - 1900; // yıl (yılın tamamını belirtir)

    auto son_değiştirilme_zamanı = std::chrono::system_clock::from_time_t(std::mktime(&zaman));

    try {
        std::filesystem::last_write_time(dosya_yolu, son_değiştirilme_zamanı);
        std::cout << "Dosyanın zamanı başarıyla değiştirildi.\n";
    } catch (const std::exception& e) {
        std::cerr << "Hata: " << e.what() << std::endl;
        return 1;
    }

    return 0;
}
Editor is loading...
Leave a Comment