Labels

Tuesday, November 6, 2018

Deal with file by C++

#include<fstream>

fstream wf("out.dat",ios::out | ios::trunc);
// fstream ofs; ofs.open("out.dat", ios::out | ios::trunc);

Sunday, November 4, 2018

Delay the program some time with C++

#include <chrono> 
#include <thread> 

int main(){
using namespace std::this_thread; /*sleep_for, sleep_until */
using namespace std::chrono; /* nanoseconds, system_clock, seconds */
sleep_for(nanoseconds(10)); 
//sleep_until(system_clock::now() + seconds(1)); 
}  
REFERENCE:
https://stackoverflow.com/questions/158585/how-do-you-add-a-timed-delay-to-a-c-program