c

Does mtrace() still work in modern distros?

Does mtrace() still work in modern distros? tldr: Does mtrace still work or am I just doing it wrong? I was attempting to use mtrace and have been unable to get it to write data to a file. I followed the instructions in man 3 mtrace: t_mtrace.c: #include <mcheck.h> #include <stdlib.h> #include <stdio.h> int main(int …

Total answers: 1

How do I change the number of columns and rows in the terminal?

How do I change the number of columns and rows in the terminal? I have been developing a graphic library for generating 2d graphics on the terminal. I need to control the number of rows and columns to specify the resolution. Asked By: Francisco Zavala || Source To change the number of rows and columns …

Total answers: 1

How do I install mysql-dev for server?

How do I install mysql-dev for server? I am working on a server plugin for MySQL v8.0 (as well as a legacy plugin for v5.7) and I need to install the correct header files. I’ve looked around the internet and all I can find is libmysqlclient-dev, which is for client dev. I need to install …

Total answers: 1

Custom alias to run and compile .c file

Custom alias to run and compile .c file I’m trying to create custom alias to to compile and run my .c files in one command. I tried to add this line in /.bashrc_aliases alias runc=’gcc $1 -lm && ./a.out’ however I get an error and it seems like the .c file doesn’t get passed to …

Total answers: 1

Detecting used API calls for an application

Detecting used API calls for an application I need to run a proprietary C++ application under Linux and I need to understand if it contains any functions outside advertised features. Is there a way to list all the API calls that the application makes granted it doesn’t use Linux syscalls and only uses standard stdc++ …

Total answers: 1

Print all C comments to a separate text file

Print all C comments to a separate text file I would like to print all my C comments to a separate text file. Using awk, sed, grep, or bash output all multi-line C comments between /* … */ (inclusive) output lines with // comments Optional: print line numbers I tried these solutions but it did …

Total answers: 5

compile error with tiny http server c code gcc debian

compile error with tiny http server c code gcc debian My distro is MX Linux (Debian) GCC was already installed with distro. I am trying to compile some open source code from Nir Lictman. His Minimalist C web server code compiles in his YouTube video. When I use gcc to compile, I get errors: servera.c: …

Total answers: 1

Making changes to the shared library

Making changes to the shared library Suppose we have a C program that uses the shared library. If you make changes to a shared library and rebuild it, all programs using that library will automatically receive those changes the next time they run. In the case of a static library, the changes become visible only …

Total answers: 3

How to run this C++ code in ubuntu?

How to run this C++ code in ubuntu? I have compiled this code: https://github.com/vbdaga/Rabbit-Cipher/blob/master/rabbit.cpp with g++ rabbit.cpp -o Rabbit but there are nowhere instructions on how to pass the arguments. I see only getline which do not help… I use Ubuntu 22.04.2 if that helps… Does anyone has any idea how to proceed? Asked By: …

Total answers: 1

Why is MB_CUR_MAX 6 instead of 4 for UTF-8? (Linux, glibc)

Why is MB_CUR_MAX 6 instead of 4 for UTF-8? (Linux, glibc) MB_CUR_MAX is defined by glibc as ‘a positive integer expression that is the maximum number of bytes in a multibyte character in the current locale.’ If I print the value I get 1. I assume that this is because C uses the C locale …

Total answers: 1

Creating a filename for an opened file descriptor

Creating a filename for an opened file descriptor I have a file on the filesystem. I’m opening the file with the open(2) function to get the file descriptor to that file. Now I remove the file. But I still have the file descriptor, so I can read and write to that file without problems, because …

Total answers: 1

How do I increase /proc/sys/fs/mqueue/msgsize_max to more than 8192?

How do I increase /proc/sys/fs/mqueue/msgsize_max to more than 8192? Is it possible to change the default value to be larger? when i try to use it in a C program it fails on values larger than 8192. printf("create queue size: %lun", attr->mq_msgsize); mqd_t mq = mq_open(name, O_CREAT | O_RDWR, 0644, attr); if (mq == (mqd_t)-1) …

Total answers: 1

Moving 3 pics randomly to another directory

Moving 3 pics randomly to another directory I am using Linux and I’m in a folder it has 10 .jpg images I want to move 3 pictures only without selection by name or size for example my folder is /sdcard /DCIM/camera/ I want 3 pictures from it to /sdcard using a Linux command it’s possible? …

Total answers: 1

gdb print out a pointer is null or not

gdb print out a pointer is null or not source:https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/optimizer/plan/planner.c (gdb) n 3556 if (root->group_pathkeys) (gdb) s 3558 else if (root->window_pathkeys) (gdb) print root->group_pathkeys==NULL No symbol "NULL" in current context. (gdb) s 3559 root->query_pathkeys = root->window_pathkeys; (gdb) s query_planner (root=root@entry=0x55ffb53fdb70, qp_callback=qp_callback@entry=0x55ffb3299ee0 <standard_qp_callback>, qp_extra=qp_extra@entry=0x7ffc5db45260) at ../../Desktop/pg_sources/main/postgres/src/backend/optimizer/plan/planmain.c:219 219 fix_placeholder_input_needed_levels(root); based on above I can guess root->group_pathkeys == …

Total answers: 1

What tells make that a file is an intermediate file (and can be auto removed)?

What tells make that a file is an intermediate file (and can be auto removed)? I’m simply studying make. And I stumble upon the question on make’s autoremoving intermediate file. I’d like to better predict how make would mark file intermediate (i.e. answer "Would auto remove it?"), so I wrote a dummy project like this …

Total answers: 1

Identifier cout is undefined

Identifier cout is undefined I am compiling below code with GCC-12 compiler on Ubuntu 22.04 LTS. I have 2 different versions of GCC installed on my machine 11 and 12. #include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; } This is my tasks.json file { "tasks": [ { "type": …

Total answers: 1

Ubuntu 23.04 C Compiler cannot create executables – C compiler works no

Ubuntu 23.04 C Compiler cannot create executables – C compiler works no This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by liberasurecode configure -, which was generated by GNU Autoconf 2.71. Invocation command line was $ ./configure ## ——— ## ## …

Total answers: 1

Is there a *BSD equivalent of MacOS renameatx_np, atomic swap file renaming?

Is there a *BSD equivalent of MacOS renameatx_np, atomic swap file renaming? I am looking to create a *BSD compatible C function like the one below: int fs_ext__swap (const char *from, const char *to) { int res = renameatx_np(AT_FDCWD, from, AT_FDCWD, to, RENAME_SWAP); return res == -1 ? uv_translate_sys_error(errno) : res; } At the moment …

Total answers: 1

Program starts from rc.local but doesn't do anything

Program starts from rc.local but doesn't do anything I have a program which uses msqllib. It scans some hardware that I build and then updates a mysql database. This program has been running for a number of years but I have never been able to autostart it when the system reboots. Now I have an …

Total answers: 2

Virtual keyboard using UHID

Virtual keyboard using UHID I am trying to achieve what the QMK firmware does for keyboards but using software. So, I would like to turn off keys, substitute some keys for others, layers and etc. The first thing that appeared for me when searching was this example. The problem is, running the test it only …

Total answers: 1