本文整理汇总了C++中std::fflush方法的典型用法代码示例。如果您正苦于以下问题:C++ std::fflush方法的具体用法?C++ std::fflush怎么用?C++ std::fflush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std
的用法示例。
在下文中一共展示了std::fflush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
for (unsigned i = 0; i < 0x8000; ++i)
{
cache.clear();
printf("\rguessing ver(4, 1, %5d) = ", i);
fflush(stdout);
unsigned guess = ver(4, 1, i);
printf("%5d", guess);
if (guess == 6)
{
printf("\nFound solution!\n");
break;
}
}
return 0;
}
示例2: defined
void
XalanFileOutputStream::doFlush()
{
#if !defined(XALAN_WINDOWS)
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::fflush;
#endif
if (fflush(m_handle) != 0)
{
XalanDOMString theBuffer(getMemoryManager());
throw XalanFileOutputStreamWriteException(
m_fileName,
errno,
theBuffer);
}
#endif
}
示例3: main
//.........这里部分代码省略.........
return 1;
}
// Close the catalog file - it will be reopened below by the QueryProcessor.
catalog_file.close();
}
// Setup QueryProcessor, including CatalogDatabase and StorageManager.
std::unique_ptr<QueryProcessor> query_processor;
try {
query_processor.reset(new QueryProcessor(catalog_path, fixed_storage_path));
} catch (const std::exception &e) {
LOG(FATAL) << "FATAL ERROR DURING STARTUP: "
<< e.what()
<< "\nIf you intended to create a new database, "
<< "please use the \"-initialize_db=true\" command line option.";
} catch (...) {
LOG(FATAL) << "NON-STANDARD EXCEPTION DURING STARTUP";
}
// Parse the CPU affinities for workers and the preloader thread, if enabled
// to warm up the buffer pool.
const vector<int> worker_cpu_affinities =
InputParserUtil::ParseWorkerAffinities(real_num_workers,
quickstep::FLAGS_worker_affinities);
const std::size_t num_numa_nodes_covered =
DefaultsConfigurator::GetNumNUMANodesCoveredByWorkers(worker_cpu_affinities);
if (quickstep::FLAGS_preload_buffer_pool) {
std::chrono::time_point<std::chrono::steady_clock> preload_start, preload_end;
preload_start = std::chrono::steady_clock::now();
printf("Preloading the buffer pool ... ");
fflush(stdout);
quickstep::PreloaderThread preloader(*query_processor->getDefaultDatabase(),
query_processor->getStorageManager(),
worker_cpu_affinities.front());
preloader.start();
preloader.join();
preload_end = std::chrono::steady_clock::now();
printf("in %g seconds\n",
std::chrono::duration<double>(preload_end - preload_start).count());
}
Foreman foreman(&bus,
query_processor->getDefaultDatabase(),
query_processor->getStorageManager(),
num_numa_nodes_covered);
// Get the NUMA affinities for workers.
vector<int> cpu_numa_nodes = InputParserUtil::GetNUMANodesForCPUs();
if (cpu_numa_nodes.empty()) {
// libnuma is not present. Assign -1 as the NUMA node for every worker.
cpu_numa_nodes.assign(worker_cpu_affinities.size(), -1);
}
vector<int> worker_numa_nodes;
PtrVector<Worker> workers;
vector<client_id> worker_client_ids;
// Initialize the worker threads.
DCHECK_EQ(static_cast<std::size_t>(real_num_workers),
worker_cpu_affinities.size());
for (std::size_t worker_thread_index = 0;
worker_thread_index < worker_cpu_affinities.size();
示例4: myMessageOutput
void myMessageOutput(QtMsgType type, const char* msg){
fprintf(stdout, "%s\n", msg);
fflush(stdout);
}