I have the simple code witch get password by getpass: Also I have a signal handler witch exit program. If signal was caught at the time of getting password from terminal, program stops, but all provided by user characters appears on bash prompt. Code of signal handler: How can I make bash prompt clear after interrupt program by signal? Answer
Tag: c++
weird issue with time function in C
I’m trying to get my Beaglebone Green to read an input from a certain pin, and when that pin sees a 1 to 0 transition (defined in pulse()), then it should set a timer. I want to make my timer like this: In idle, the timer is set to a TIMER_HOLD value (900000) To start the timer, I set it
Will process’s RES memory drop after memory freed?
I have a process which continuously allocates memory and will free it after another thread have processed related data. When the data processing rate is slow, I see RES memory grows up; but after all the data have been processed, RES goes down but doesn’t go back to original RES value (even after waiting for over 10 minutes). e.g. 10
Linking shared objects at runtime depending on user configuration
TL;DR I have a library I want to use in my program which comes in two different versions. Both versions provide the same interface but differ in options used to compile them. I now want to use a specific version of the library, however, since both versions are suitable for different tasks and the user should define the task to
How to compile opencv with gtk 2.x rather than gtk3.x
I’m using tensorflow 1.4 & qt in ubuntu 16.04. The problem is when I include tensorflow(version: 1.4) and opencv (version: 3.2.0) simultaneously, protobuf is conflicted. The error msg is as follows: [libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:79] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.4.0). Contact the program author
rlim_t errors with login_cap.h in Debian
I’m trying to compile the bsdmainutils package in Debian that uses the /usr/include/login_cap.h header (from libutil-freebsd-dev), and I’m getting a bunch of errors like this: I’m using Debian testing. Is this a bug in login_cap.h? I see rlim_t defined in /usr/include/x86_64-linux-gnu/bits/resource.h – can I just include that file within login_cap.h? If so, do I have to include the arch-dependent path
Giving an executable more permissions than running user
I have a small C++ app to turn on and off lights for a BeagleBone Black board that runs on Debian 9.2. It does this by updating text files. If I run the program as a standard user it runs without error but none of the lights change. If I run the program with sudo everything works fine and the
Scanning numbers from a file in C
I tried to scan some coordinates [X, Y, Z] from a file, but always returned as segmentation fault. So, I’ve some questions to make: I don’t know how many points are in the file, but if I leave the struct arrays empty, there will be an error. There is a way to do this without defining a max number? Are
how does getline read only up to a newline without seeking?
I’m imagining reading byte by byte would be very inefficient, but reading in bulks would almost always read more than needed, requiring to store the rest of the read input in a global context for all subsequent read operations to find. What am I missing? Answer The prototype is: So it’s clearly using FILE, which is already buffered. So reading
Writing to Linux device driver causes infinite loop
I have been writing a kernel space device driver that can be read from and written to from user space. The open, read, release operations all work perfectly. The problem I am having is with the user-space code that should access the device driver and and write something to it. The user-space program writes to two files: 1) to a