當前位置: 首頁>>代碼示例>>C++>>正文


C++ std::fflush方法代碼示例

本文整理匯總了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;
}
開發者ID:btrzcinski,項目名稱:synacor-challenge,代碼行數:18,代碼來源:ver.cpp

示例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
}
開發者ID:mcasperson,項目名稱:xalan.js,代碼行數:19,代碼來源:XalanFileOutputStream.cpp

示例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();
開發者ID:mindis,項目名稱:quickstep,代碼行數:67,代碼來源:QuickstepCli.cpp

示例4: myMessageOutput

void myMessageOutput(QtMsgType type, const char* msg){
               fprintf(stdout, "%s\n", msg);
               fflush(stdout);
}
開發者ID:26filip,項目名稱:Cascades-Community-Samples,代碼行數:4,代碼來源:main.cpp


注:本文中的std::fflush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。