A few weeks back i was prototyping something in SDL2 (using SDL Surfaces) to make stippled lines for my app PGM. I did conplete the code; At first I assumed it was working as intended but when i ...
I am trying to implement a GUI for xv6 operating system as a project for my school. I set up the GUI part and now need to implement the portion where the kernel picks up the mouse input and render the ...
I'm building a multi-threaded HTTP server from scratch. Each request is logged to stdout, but when multiple threads print simultaneously, the logs get corrupted (e.g., entries interleave like this):...
I had to predict the output of this code in a question :#include <stdio.h>int main( ) { int arr[] = { 10, 20, 30, 45, 67, 56, 74 }; int *i, *j; i = &arr[1]; j = &arr[5]...
I expected that without calling fclose(), and with the buffer not being full, nothing would be written to the file. But when the program finishes, the data still appears in the file.Or the C runtime ...
I tried to find a way to verify deadlock with CPA checker. My goal is to check the "problem of philosofer".I found a lot of problem with CPA checker and threading.Someone can help me find ...
Suppose I have a database in memory that I want to modify.Let's say the tables are phone information and items.The phone information consists of a name up to 99 characters and a character code.The ...
When running the following program (on Linux):#include <stdio.h>#include <wchar.h>int main() { wprintf(L"Hej hopp: %lc\n", L'ä');}...the program outputs Hej hopp: ?, ...
OK so I'm trying to create some educational content, and I seem to have come to an impasse myself. I'm building a very simple C / ASM project just to demonstrate linkage. All appears fine and well ...
I'm currently trying to make a dll for Windows 95. I am writing this app in C using Visual studio 2022 Community Edition. The Problem I am having is that there are a lot of imports from some dlls that ...
I have the following code as part of a buffer overflow CTF challenge:#define _GNU_SOURCE#include <stdio.h>#include <string.h>#include <unistd.h>int my_gets(char *buf) { int ...
I found a toy program here (http://stackoverflow.com/a/16400833) to check out named semaphores. I modified it somewhat, opening the named semaphore in each child thread instead of in the parent ...
I have some old IPv4 C socket server code running on Linux that seemingly correctly binds to INADDR_ANY, but netstat -tuln | grep <port> shows that it's only listening to the specific IP address ...
Does anyone know if there some simple C (or any other language) code for a peer client and registry server?I want to test it and learn from an example.I asked an LLM it gave me this code: https://...