When should I use mmap for file access?

POSIX environments provide at least two ways of accessing files. There’s the standard system calls open(), read(), write(), and friends, but there’s also the option of using mmap() to map the file into virtual memory. When is it preferable to use one over the other? What’re their individual advantages that merit including two interfaces? 6 … Read more

How do I execute a command and get the output of the command within C++ using POSIX?

I am looking for a way to get the output of a command when it is run from within a C++ program. I have looked at using the system() function, but that will just execute a command. Here’s an example of what I’m looking for: std::string result = system(“./some_command”); I need to run an arbitrary … Read more