Skip to content

Tag: c++

getcwd() vs get_current_dir_name()?

Is it better to use getcwd(NULL, 0) or get_current_dir_name() ? What is common practice ? My uninformed guess is that a call to getcwd(NULL, 0) may be a better idea since it is possible that the PWD variable is not set… Answer Is it better to use getcwd(NULL, 0) or get_current_dir_name() ? What is commo…

Why this variable lies on same address

Here I have taken two local variables and printing the address of both. I am getting both addresses is same how? code is here: and the output is: here the str and arr[1] address are the same. please help me out. thank you in advance Answer In char arr[][15]={0};, the blank subscript leaves it to the compiler …

Can I use QFile to truncate a write protected file?

I am not running the application itself as root. Rather than do a convoluted With QProcess, I would rather simply open /sys/devices/system/cpu/intel_pstate/min_perf_pct and truncate a number into it. It would look something like this: Is there a way to do this without having to start or run any other part of …

Embedded python fails to compile on Raspberry Pi

I installed python 3.9.1 on my Raspberry Pi following the instructions here https://www.ramoonus.nl/2020/10/06/how-to-install-python-3-9-on-raspberry-pi/ and set it as the default python interpreter. I got my compiling and linking parameters for embedded Python following the instructions here https://docs.pyt…

ncurses newterm following openpty

I am trying to figure out how to do the following: create a new pseudo-terminal open a ncurses screen running inside the (slave) pseudo terminal fork A) forward I/O from the terminal the program is running in (bash) to the new (slave) terminal OR B) exit leaving the ncurses program running in the new pty. Can…