随笔分类 - C++ / C++实战案例
C++ 实战,标准类的用法
摘要:// Source : https://www.geeksforgeeks.org/bitonic-sort/ /* C++ Program for Bitonic Sort. Note that this program works only when size of input is a pow
阅读全文
摘要:/// c++ 内存文件使用例程class MemoryBuffer : public std::strstreambuf { public: using Base = std::basic_streambuf<char>; using char_type = typename Base::char
阅读全文
摘要:#include <iostream> #include <filesystem> #include <string> namespace fs = std::filesystem; void demo_status(const fs::path& p, fs::file_status s) { s
阅读全文
摘要:1.path类:文件路径相关操作,如指定的路径是否存在等; 2.directory_entry类:获取文件属性等,如指定文件是否是常规文件,还包括文件大小、文件最后修改时间; 3.directory_iterator类:遍历目录,获取目录文件,不包括子目录,其介绍参见; 4.recursive_di
阅读全文
摘要:#include <iostream> #include <fstream> using namespace std; int main() { ifstream infile; try { infile.open("file.txt"); if (!infile) { throw runtime_
阅读全文
摘要:#include <iostream> #include <semaphore> #include <thread> using namespace std; std::counting_semaphore<3> csem(0); // semaphore release = condition_v
阅读全文
摘要:#include <iostream> #include <filesystem> namespace fs = std::filesystem; void traverseDirectory(const std::string& path) { for (const auto& entry : f
阅读全文
摘要:#include <iostream> #include <strstream> using namespace std; int main() { char szBuf[16] = {"hello world!"}; std::strstreambuf memo(szBuf,sizeof(szBu
阅读全文

浙公网安备 33010602011771号