CPlusPlus
CPP – Don’t append `\x00` to std::string
Record an experience of debugging. Here are two ways to read string and store it in std::string.One will have ‘\x00’ in std::string object, the other has not.
Record an experience of debugging. Here are two ways to read string and store it in std::string.One will have ‘\x00’ in std::string object, the other has not.
We want to create a file which path looks like /Folder1/Folder2/Folder3/file.txt. The parent directory Folder3 of file.txt has to be there, or the creating action will fail. Similarly, Folder2 and Folder1 need to be on the disk firstly. If you are a Linux OS user, you can use the following Read more…
The project shows how to call JS function defined in web page by CPP code. Here is files tree for projThe images display the directory tree of the project. The main logic code about our question: worker.cpp index.html The whole project had been uploaded to GItHub: https://github.com/theArcticOcean/tutorials/tree/main/learnWebAssembly/CppWasm The build way Read more…
The function insert of std::map would fail if the key equivalent to the one of an element already in the container.when it happens, the new element is not inserted, and return an iterator to this existing element. Demo: The update can be done successfully if we use operator [] for Read more…
The following content involves the concepts of synchronous and asynchronous. Here is a C++ class that simulates a timer. Output asynchronously. To simulate a timer for sequentially outputting numbers, we can do it like this: We cannot execute the task of rendering frames by creating a new thread in this Read more…
OS: Ubuntu 22.04.2 LTS. Download eigen from website: https://eigen.tuxfamily.org/index.php?title=Main_Page Small Eigen Project Write a file main.cpp which use eigen library. Build and run it. Use Lapack In Eigen In C++ Project Write test code to use lapack, build and run the project. Create a file matrix.txt Run the executable file by Read more…
The test environment is Linux system and C.These interfaces can be used in wasm project to check files in virtual memory.
The interface GetCenter gives us the center of bounding box rather than barycenter of model. Here is source code from VTK9.2.0.
If you are on linux os, you needn’t add library setting in CMakeLists.txt. The libray iconv files has been inside system path. main.cpp