That is, how to create a new screen buffer and read/ write buffer contents in Linux? The screen buffer I am talking about refers to the content displayed to the user. Or the entire screen. I don’t want to use ncurses. I found terminfo, but I want a function instead of an command. Perhaps ioctl can read the buffer, but
Tag: c++
‘DT_REG Undeclared’ even when using header file in function
I’m using the <dirent.h> header file in the function I’m referencing DT_REG, however, I’m getting error an saying ” ‘DT_REG’ undeclared (first use in this function) ” The snippet of the code is: In my makefile I’m using “cc -std=c11 -Wall -Werror -pedantic”. Any ideas for the reason? Answer DT_REG is not part of ISO C11 extensions. Setting -std=c11 strictly
Ping program implementation in C about recvfrom() doubts
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this. I have finished writing the program, and today when I tested the ping loopback address, after sending the packet, the function recvfrom() received the “first” packet (type 8), and the second recvfrom() received the response packet
Why does this nostdlib C++ code segfault when I call a function with a thread local variable? But not with a global var or when I access members?
Assembly included. This weekend I tried to get my own small library running without any C libs and the thread local stuff is giving me problems. Below you can see I created a struct called Try1 (because it’s my first attempt!) If I set the thread local variable and use it, the code seems to execute fine. If I call
Compiler cannot find header file within header file in C++
I have a header file provided by yaml-cpp library, yaml.h yaml.h: main.cpp All the header files are in the same directory (/home/user/application/libs/yaml-cpp/include), but the compiler is unable to find parser.h and all the other includes. Why is this so and how do I fix it? I have tried using g++ -I/home/user/application/libs/yaml-cpp/include main.cpp but that did not work. I am on
SWIG: Access Array of Structs in Python
Say I have the following static constexpr array of c struct: How can I access elements in ns1::ns2::PERSONS in python by using swig? One way I can think of is to create a accessor like const Person& get(uint32_t index) in the swig interface file. Tho, I wonder whether there is a more elegant way that I don’t have to create
Kill child process spawned with execl without making it zombie
I need to spawn a long-running child process and then kill it from the parent code. At the moment I do like this: This does the job in the sense that the child process is stopped, but then it remains as a zombie. I tried to completely remove it by adding: to no avail. I must be doing something wrong
C Language program executable file extention naming convention ( a.out )
Are there good practices or preferred industry standard conventions on how to name (what would be named by default as) a.out files, especially in terms of their extensions? If it depends on the platform, I’d like to know especially for Linux. Technically I won’t even need an extension, and most modern shell helps identify executable files by green color, nevertheless
How does the bitwise AND help in the if statements in the Linux Kernel?
Background on what the code is trying to achieve: “Various parameters of the new process (e.g., euid, egid, argument list, environment, filename, etc.) that are subsequently passed to other functions are, for the sake of simplicity, combined into a structure of type linux_binprm. prepare_binprm is used to supply a number of parent process values (above all, the effective UID and
error: ‘res_ninit’ was not declared in this scope; did you mean ‘res_init’?
I am trying to install an application from its source code in the alpine it says there is no res_ninit, res_nsearch and res_nclose but we can see here that do exists in the Linux headers and I have already installed apk add linux-headers, how can I resolve this issue? Update: I cat the header file /usr/include/resolv.h and we can see