Category "c"

What is the most efficient way to copy many files programmatically?

Once upon a time long ago, we had a bash script that works out a list of files that need to be copied based on some criteria (basically like a filtered version

How to divide two unsigned long 64 bit values in x86 assembly and then returning the quotient and remainder to a C program

In a separate C program, I have passed 4 parameters to an x86 ASM program. dividend divisor Quotient pointer Remainder pointer dividend = 0xA divisor = 0x3 Whic

Insert and Delete element on Circular Queue

I'm studying about circular queue in data structure . As you can see from the code below, I try to delete a specific data and insert data on Circular queue. How

Python Ctypes - loading dll throws OSError: [WinError 193] %1 is not a valid Win32 application

I have tried to run an exemple of a python code that gets a function from a library using ctypes. The exemple can be found here. I followed the instruction and

Is there a way to remove all leading and trailing whitespaces of a string in C without the use of external librarys? [closed]

I have been recently trying to make an OS using the C language. The OS shell needs to get the string "ADD" from the string " ADD ". I ne

CMAKE Esp32 using azure iot samples - what to check in into my repository

I am really new to iot/embedded world (I come from the b2b java world). Currently I am starting setting up an ESP32 based project. So far I tried esp-idf Hello

How can I declare a Pointer to a struct in C?

I have learned that pointers can be declared in 3 different ways: int* a; int *b; int * c; I prefer: int* a; While declaring a pointer to a structure, is it c

variably modified 'stack' at file scope [duplicate]

int const a=9; int stack[a]; int main() { return 0; } The above code gives an error:variably modified 'stack' at file scope But when I

Round 37.1-28.75 float calculation correctly to 8.4 instead of 8.3

I have problem with floating point rounding. I want to calculate floating point numbers and round them to (given) N decimals. In this example I want to round to

memory bandwidth for many channels x86 systems

I'm testing the memory bandwidth on a desktop and a server. Sklyake desktop 4 cores/8 hardware threads Skylake server Xeon 8168 dual socket 48 cores (24 per so

Strange warning when calling sprintf with .* width specifier

For the following code: https://godbolt.org/z/WcGf9hEs3 #include <stdio.h> int main() { char temp_buffer[8]; double val = 25.3; sprint

Yacc generated C file sccsid warning supression

I am working on a legacy project that uses yacc - 1.9 20130304. The generated .c files contain the sccsid string (from the skeleton.c): #ifndef lint static cons

net/rime.h error using Cooja, how can I install it but not just download it?

I am trying to do a simple simulation in Cooja (literally the example on the Contiki website here). However I have an error message linked to my #include "net/r

Difference between printf and ESP_LOGI?

I just want to know, what is the difference between esp's ESP_LOGx and printf, related to memory use and its other features. And which is the best to use for lo

Select build type at conan build step

This is a simple need of selecting build type when calling conan build. Normally we have to call conan install with the desired build type and then conan build

Can we unit test memory allocation?

I have to test a library that provides its own memory allocation routine: void* allocation_routine(size_t size) throw(); Documentation states that this funct

why is the output 1 in this case and when i am doing t-p then its giving me -1

As you can see it is giving me 1 but why? When i do t-p then it gives me -1 . Why ? int f=4, o=8; int *p, *t; p = &f; t = &o; printf("Difference betwee

How to establish semaphore between two different files and synchronize data

I am currently working on semaphore concepts ,. I Have two files I have to share data between two files Eg : application1.c It increments one value and shares t

What types of error when using the wrong format specifier in printf

Floating-point format specifier is used in printf by the argument has a integer number. What kind of error is it? Is it a run-time error or a syntax error? erro

Error "assignment from incompatible pointer type" when creating a Netfilter kernel module

I'm implementing a "mini firewall" and use the filter function with the signature shown below: unsigned int minifw_inbound_filter(unsigned int hooknum, struct s