Skip to content
Advertisement

Tag: c++

log4net cross platform XML config

I have a requirement to store my log files in a Logs sub folder. Normally you would do this my modifying the FileAppender in you App.config as follows: However this is not cross platform because if you run this on linux it will create a file called ‘LogsMyLog.log’ rather then a directory. This is because ” is not a path

Why we call the signal function in the start of the linux c program?

The program is very simple, I have a handler function named fintr() and the program is: Can I put signal(SIGINT,fintr); at the end of the function main()? And why do we have to put it in the beginning of main()? Answer Putting it at the end means it will come after the while (1) … loop, so no, you can’t

How to mount image using mount(2)

I cannot mount some IMAGE on the MacOSX 10.10 via C function mount(). I use following code And when I start the program I get the error “mount() is failed! Error(Operation not supported by device).” And image was mounted if I use the following command: Also, when I use mount() on the Linux – All is OK. Following Linux code:

How to squash bug that only occurs with optimizations enabled

I’m in a bit of a pickle. I have some code that until recently ran fine but has now started to fail when optimizations are enabled. This code runs just fine with optimizations disabled -O0 both -O1 and -O2 cause the issue to occur (I don’t use -O3). Unfortunately, I can’t post the source code (it’s rather involved and proprietary)

Strtok behaviour with delimiter

Below is the code snippet. This works fine. But, when the “line” argument is “Front Board Memory status:Correctable ECC / other correctable memory error detected ; sensor (70, Memory)” The output will be 70 SENSOR_SPECIFIC MEMORY STATE_00 True 8543 Front Board Memory status where the short_text variable contains only “Front Board Memory status” instead of “Front Board Memory status:Correctable ECC

Workaround for bug in mono: Wrong Process.ProcessName

If you work with mono and use Process.ProcessName you may get wrong results on some computers. For example instead of the process name “kwrite” you may get “kdeinit4” (seen on SUSE). On Ubuntu I have even seen complete bullshit like “kdeinit4;5535948c (deleted)” instead of “kwrite”. Note: On other computers the result may be correct. If I use Process.MainModule.ModuleName it retruns

Executable file didn’t work correctly [Linux]

I write a program on Qt C++ GUI, that from given user input generates three .cpp files with proper syntax (C++). When I start my program from Qt Creator directly or run it from console like a script its creates the files in executable directory correctly: When I double click executable file, the program starts and work fine, but It

Advertisement