本文整理匯總了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);
}