unresponsiveui.cpp

来自「很经典的书籍」· C++ 代码 · 共 23 行

CPP
23
字号
//: C11:UnresponsiveUI.cpp
// Lack of threading produces an unresponsive UI.
//{L} ZThread
#include "zthread/Thread.h"
#include <iostream>
#include <fstream>
using namespace std;
using namespace ZThread;

int main() {
  const int sz = 100; // Buffer size;
  char buf[sz];
  cout << "Press <Enter> to quit:" << endl;
  ifstream file("UnresponsiveUI.cpp");
  while(file.getline(buf, sz)) {
    cout << buf << endl;
    Thread::sleep(1000); // Time in milliseconds
  }
  // Read input from the console
  cin.get();
  cout << "Shutting down..." << endl;
} ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?