popen equivalent in c++

You can use the “not yet official” boost.process if you want an object-oriented approach for managing the subprocess. Or you can just use popen itself, if you don’t mind the C-ness of it all.

Why does SIGPIPE exist?

I don’t buy the previously-accepted answer. SIGPIPE is generated exactly when the write fails with EPIPE, not beforehand – in fact one safe way to avoid SIGPIPE without changing global signal dispositions is to temporarily mask it with pthread_sigmask, perform the write, then perform sigtimedwait (with zero timeout) to consume any pending SIGPIPE signal (which … Read more

OpenMP and CPU affinity

Yes, named calls will work to set thread affinity. The only problem is to fix thread number and to set right affinity in right thread (you can try using static scheduling of for loop for known number of threads). As I know, almost every openmp allows to set affinity via environment. The name of environment … Read more

Reference a GNU C (POSIX) DLL built in GCC against Cygwin, from C#/NET

The main problem which you has is following. Before you can use your helloworld.dll a cygwin environment must be initialized (see http://cygwin.com/faq/faq.programming.html#faq.programming.msvs-mingw). So the following code in native C++ will works: #include <windows.h> typedef int (*PFN_HELLO)(); typedef void (*PFN_CYGWIN_DLL_INIT)(); int main() { PFN_HELLO fnHello; HMODULE hLib, h = LoadLibrary(TEXT(“cygwin1.dll”)); PFN_CYGWIN_DLL_INIT init = (PFN_CYGWIN_DLL_INIT) GetProcAddress(h,”cygwin_dll_init”); init(); … Read more

Is Android POSIX-compatible?

GNU libc (glibc) is too big and complicated for mobile phones, so Android implements its own special version of libc which is Bionic libc, which itself does not fully support POSIX. One of the most lacking features in the android Bionic libc is pthread_cancel(), so if you don’t use it, your code will probably do … Read more

Setting creation or change timestamps

For ext2/3 and possibly for ext4 you can do this with debugfs tool, assuming you want to change the ctime of file /tmp/foo which resides in disk /dev/sda1 we want to set ctime to 201001010101 which means 01 January 2010, time 01:01: Warning: Disk must be unmounted before this operation # Update ctime debugfs -w … Read more