Category "c"

I am writing C function that convert lowercase char to upper case char with using ASCII but Output is not correct

Okay, So I start working on this, I have code below; +I also have strlen("any string here") func that return len of any str in decimal just keep in your mind. I

Arduino SD -> File extension

I found this example to list all files on the SD Card: void printDirectory(File dir, int numTabs) { while(true) { File entry = dir.openNextFile(); if (!

Flex lexer modifying constant in output .lex.c file

I'm working with flex to generate custom language. I'm wondering if there is a possibility to add in some way a setting that will change a part of generated .le

VSCode - disable comments auto-formatting for C code

I just installed an extension prettier in vscode to autoformat my code. However all the comments in my code are being moved towards the left. Which I don't want

Print out value of stack pointer

How can I print out the current value at the stack pointer in C in Linux (Debian and Ubuntu)? I tried google but found no results.

How can I make an ordered linked list?

I have to make an ordered linked list by organization name and then by size. I have to compare the organization name first and then I have to sort them by size

Insertion sort error occurring in a C program

I am probably missing something simple here, but I was looking over some simple algorithms in C and have not been able to get the insertion sort in the code bel

Best way to read from a sensor that doesn't have interrupt pin and requires some time before the measurement is ready

I'm trying to interface a pressure sensor (MS5803-14BA) with my board (NUCLEO-STM32L073RZ). According to the datasheet (page 3), the pressure sensor requires s

qemu-system-i386: Error loading uncompressed kernel without PVH ELF Note

Im trying to boot my OS to qemu with this code: qemu-system-i386 -kernel MyOS/mykernel.elf But I keep getting this error: qemu-system-i386: Error loading uncom

Cannot move camera using libuvc

I'm trying to control my camera using libuvc. I tried this code I modified from the example: #include <libuvc/libuvc.h> #include <stdio.h> #include

Windows CreateFile Possible Error Codes

I'm playing around with abstracting Windows, Linux, and Mac File IO calls into macros (to avoid C runtime, so no fopen, fclose, etc...). I've actually got quit

Cannot move camera using libuvc

I'm trying to control my camera using libuvc. I tried this code I modified from the example: #include <libuvc/libuvc.h> #include <stdio.h> #include

How do I use SDL2 in my programs correctly?

I want to make a game using SDL2, but I'm unable to compile and/or run my code, please help! SDL2 is notoriously hard to set up, and it's often the first libr

Move object creation to setup() function of arduino

I've created a class that handles sending data to a led matrix (max7219). This is what I was doing to create an instance of the LedControl class. LedControl l

Convert python int into int16_t type

I know that python int can be converted into an c int type using ctypes.But how do I convert a python int into an int16_t type? I have tried: import ctypes as

how to call function pointer in a struct?

I am working with the xinu embedded operating system in c. I created a new header file and declared a struct: struct callout { uint32 time; /* Time of d

Convert python int into int16_t type

I know that python int can be converted into an c int type using ctypes.But how do I convert a python int into an int16_t type? I have tried: import ctypes as

how to call function pointer in a struct?

I am working with the xinu embedded operating system in c. I created a new header file and declared a struct: struct callout { uint32 time; /* Time of d

GTK 4 and applications icons : how to include an application icon in a portable way?

I have difficulties to understand the icon system in GTK 4 (I work in C language). In GTK 2 and 3 that was easy to instruct the OS about the icon to use for dis

accessing long double bit representation

TLDR; Does the following code invoke undefined (or unspecified) behaviour ? #include <stdio.h> #include <string.h> void printme(void *c, size_t n