Untitled
unknown
plain_text
2 years ago
850 B
7
Indexable
#include <iostream>
#include <fstream>
#include <ctime>
int main() {
std::ofstream logFile;
std::time_t currentTime = std::time(nullptr);
std::tm* localTime = std::localtime(¤tTime);
char filename[100];
std::strftime(filename, sizeof(filename), "keylog_%Y%m%d.txt", localTime);
logFile.open(filename, std::ios::app);
if (!logFile) {
std::cout << "Hata: Kayıt dosyası oluşturulamadı!" << std::endl;
return 1;
}
std::cout << "Tuş vuruşlarını kaydetmek için programı çalıştırın..." << std::endl;
std::cout << "Programı sonlandırmak için Ctrl+C tuşlarına basın." << std::endl;
char key;
while (true) {
if (std::cin.peek() != EOF) {
key = std::cin.get();
logFile << key;
}
}
logFile.close();
return 0;
}
Editor is loading...