Skip to content

Tag: c++

Check architecture for Linux and Mac

I’m trying to get the architecture of the computer executing my software, and so far it is working nice on Windows, but it fails on Linux and OSX. Let me show my current code: Linux and Mac always return “Processor is 32-bit”, so I guess that those environment variables are unused outside Wi…

Diifferetn result in Linux and Visual Studio

Does anybody know why compiling program in Visual Studio 2015 gives different result (those are correct I want to keep them) vs Linux Ubuntu (those are wrong).? Answer Reading beyond the end of an array invokes undefined behavior in C. Once your program invokes undefined behavior anything can happen or nothin…

Mono executes program with wrong current directory

I have a strange problem. I have written a custom spamfilter in C# .NET 4.6 for personal use. And I put this program up to my Raspberry Pi. I have tested many times the program, and everything worked fine, but when I created a cronjob I have noticed that the program never writes log. As I started to test agai…

Linux synchronization without polling

In principle what I want is very simple. Two executables ./read and ./write respectively read and write from a resource (let’s say a file). Using flock(2) it is easy to prevent race conditions between arbitrary invocations of ./read and ./write at arbitrary times. The requirement is that each invocation…