Category "c"

Missing separator in generated Makefile

I'm trying to compile this decade-old project: https://github.com/komar007/freecg The makefile generates Makefile.dep which seems incorrectly formatted. How sho

Purpose of bitwise operation in this example

In the function outb(0x3D5, (uint8_t) (pos & 0xFF));, I am having trouble understanding the purpose of the bitwise operation. pos is a uint16_t variable. Wh

C pointer to a pointer confusion

I have the following code. I tried to change the value of y by using a pointer to a pointer (i.e. trying to do a de-referencing twice from the pointer that poin

How to get the total?

Good day, I am practicing about Arithmetic and started to experiment a bit and got confused. How can I total the liter, refueled, and tendered? #include <std

How do I search most common words in very big file (over 1 Gb) wit using 1 Kb or less memory?

I have very big text file, with dozens of millions of words, one word per line. I need to find top 10 most common words in that file. There is some restrictions

i can't seem to understand a C code to sort a linked list of data

i have been given a code to sort a linked list that contains links (we call them maillons in french, sorry i don't really know how it's called in english) of Op

Creating process with elevated privileges using CreateProcessAsUserW from system service

I'm trying to launch a process from a system service using the token handle of the currently active user with elevated privileges (if user is in admin. group).

how to get the bare bone compiled binary code of a C function?

I'm trying to implement an embedded firmware on an stm32 F4 micro that takes an binary code from the serial and execute it on the micro. The idea is pretty simp

trying to reverse string without string function strrev but not working in c

#include <stdio.h> #include <string.h> void main(void) { char in[15], rev[15]; printf("Enter a word (upto 15 letters): "); gets(in);

Different C++ fork() behavior between CentOS 7.5 & RockyLinux 8.4, Ubunu 20.04

I'm working with some legacy code. It works fine on a CentOS 7 system. The args array gets hosed on both a Rocky 8.4 and Ubuntu 20.04 system. I've simplified th

GTK treeview: disable highlight when selected

I try to disable highlight on a row when it is selected for a GtkTreeView widget (default is blue background and white text color). I tried to change the STATE_

Error: Called Object is Not a Function or Function Pointer [Need Help]

//File Name: "track_distance.h" #ifndef TRACK_DISTANCE_H_INCLUDED #define TRACK_DISTANCE_H_INCLUDED typedef struct Point_struct { float x; float y; }

How do I convert a number to a string without using stdlib.h or string.h?

Here is my exercise: Write a function that receives from the user two strings that show two real numbers (possibly negative), And produces a string that contai

Load and use a Glade layout in GTK2/C

I was trying to load a Glade layout into a GTK2 C code. It consists of a window in which there is a VBox with 2 elements: a label and a button. I want to associ

Where do the values of uninitialized variables come from, in practice on real CPUs?

I want to know the way variables are initialized : #include <stdio.h> int main( void ) { int ghosts[3]; for(int i =0 ; i < 3 ; i++) printf(

Trying to use a bool to move stepper motor only once, if bool / latch is removed it works in loop but in current set up it does not run. Any ideas?

I'm trying to run a stepper motor a fixed number of steps before stopping. I'm having trouble implementing the bool has_run variable. I've carried out debugging

MinGW Debugger in VS Code is Stuck at Building tasks. What can I do to get it back to normal? I

Earlier it used to create the .exe files whenever I hit the F5 button to debug the code. But now for some reason I am unable to get it right and I messed up wi

Pairwise Balanced Incomplete Block Design in C

I have to make a pairwise BIBD in C (using backtracking), but i don't know how to generate the blocks and check for pairs of points I thought I could make a 2d

Why does it iterate one more time even if it is NULL?

Similar question here . What I want to understand is that when current_node is NULL, the compiler doesn't see it as NULL and iterates one more time. void pr

writing to FILE for transmission over USART

I have a bit of code written by someone else that I'm trying to understand. I'm familiar with c enough to make basic/intermediate functions, but never really le