Category "c"

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

How to build a standalone C ELF binary without installing libraries on a remote machine?

I am trying to build a C ELF binary on linux and try to execute it directly on another machine. (Sent via scp linux command) The problem is that even when I bui

Tree traversal - Segmentation fault error

Code : #include<stdio.h> #include<malloc.h> typedef struct tree { char data; struct tree *left; struct tree *right; }*pos; pos stack[

/bin/cat :Bad file descriptor

I am pretty new to the pipe(), fork() functions and /bin. I would like to pass a value through a pipe from my first child to my second child that I will later u

Uncommon baud rate on serial port - Linux

I'm currently trying to make a programm to read a serial port. On this port I receive data with a baud rate of 875000. It's really uncommon and I don't succeed

Reading C program's output files in javascript

I'm trying to connect two programs I wrote- one is a c program that outputs files to my local disk and the other is a web program that's supposed to show the co

XINU - How can I take control over an interrupt vector

Well, I've met this question a lot in OS, we've implemented this by diff. ways (Inline Assembly with setvect, getvect, etc..) At XINU it's a little bit differe

How to create a folder in C

How can I create a new folder for an email manager, I have this code but It doesn't work. void create_folder() { int check; char * dirname; clrscr();

How to debug in kernel mode using printk

I am trying to add some stuff to Linux task_struct. In this area I copy a string from the user and try to store it in my struct. I try to debug my code by add

How to download a file from http using C?

I spent the last days trying to figure out how to download a file from an URL. This is my first challenge with socket and I'm using it to have an understanding

What is the difference between C, C99, ANSI C and GNU C?

I have started programming practice on codechef and have been confused by the difference between C and C99. What does C mean here? Is it C89? Check the language