The issue doesn't occur when I run the compiled program as an administrator.
Looking at SysInternals, it seems that the problem is caused, because the application wants to create a file "C:\1.dat". Since non-administrators have no access to the root directory of C:, this will not work.
But what can I do? It is not possible to always run the progs as an administrator.