Skip to content
Advertisement

Tag: c++

boost asio notify server of disconnect

I was wondering if there is any way to notify a server if a client side application was closed. Normally, if I Ctrl+C my client side terminal an EOF-signal is sent to the server side. The server side async_read function has a handle which has boost::system::error_code ec argument fed into it. The handle is called when the server side receives

Is there a way to automatically link all libraries an OpenGL program needs, without explicitly writing their flags on compile?

For an entry level program, I’m currently compiling with g++ manip.c -o manip -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -ldl -lXinerama -lXcursor -lGLEW It was a very time-consuming process of trial and error figuring out which flags were necessary, googling the ‘undefined references to’, copy pasting every flag I came across and then deleting flags one by one until I had

Running bash using posix instead of fork/execv

I have a CLI, one of the commands is entering into Linux bash shell. This is the code which does it using fork & execv: I want to replace the fork/execv and to use posix_spawn instead: But it doesn’t work. Any help? Answer Let’s look at what the code in the original fork/exec does: close all file descriptors open the

Linux: Reading file while other program might modify it

A program Foo periodically updates a file and calls my C program Bar to process the file. The issue is that the Foo might update the file, call Bar to process it, and while Bar reads the file, Foo might update the file again. Is it possible for Bar to read the file in inconsistent state, e.g. read first half

Advertisement