408,323 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
104
views
How to validate that a string is of a desired value with integers in certain positions in C?
I am working on a uni project (I have to develop a to-do list type terminal application [second semester Computer Science]) and I have been wondering how to make this initial part of the algorithm ...
-4
votes
0
answers
67
views
C function in iOS library code gets stripped when distributed to testflight [closed]
This is a continuation of https://developer.apple.com/forums/thread/795348
I rambled too much and did not understand the underlaying problem.
The problem is that I have a C function in a iOS library. ...
-3
votes
3
answers
66
views
glibc startup code appears to overwrite stack variable when debugging with GDB [closed]
Description
While debugging a small C program on Linux with GDB, I noticed that a local variable in main appears to contain ELF header bytes right at function entry:
s = 0x7ffff7fc1000 "177円ELF\...
3
votes
1
answer
101
views
How to make C shell exit immediately on Ctrl+D (EOF) when the buffer contains text?
I am writing a simple shell in C on Linux. My goal is to handle the Ctrl+D (EOF) signal such that if the user types a command (e.g., ls) and presses Ctrl+D, the shell exits immediately without running ...
-4
votes
0
answers
120
views
Why does the GetAdaptersInfo() Windows API use contiguous memory for a linked list? [closed]
I am confused as to why GetAdaptersInfo() requires a contiguous block of memory to store a linked list of IP_ADAPTER_INFO structs.
During the first call, we pass the memory location of a ULONG that is ...
-1
votes
0
answers
72
views
values of linked list node members uncontrollably changing and the program sometimes crashes during iteration through it on Windows [closed]
i'm working on the game on C and i wrote a function for saving records in the file.
these records have four parameters: size, difficulty_level (they are integers), hints (boolean) and time (uint32_t). ...
1
vote
1
answer
78
views
How to avoid SSL being enforced with the MySQL/mariadb connector
Consider this minimal example program:
#include <mysql/mysql.h>
#include <stdio.h>
int main() {
MYSQL *conn = mysql_init(NULL);
unsigned int mode = SSL_MODE_DISABLED;
...
3
votes
0
answers
80
views
On Wayland, my SDL2 program crashes with 'Wayland display connection closed by server' when drag and dropping an file?
My program creates a window and renderer, and I have a basic event loop to handle SDL_DROPFILE events:
#include <stdio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#define ...
0
votes
1
answer
112
views
C program gets stuck while executing [closed]
I have a C program and I'm using Meson+Ninja to build it.
project('NESt', 'c')
source_files=files('src/main.c',
'src/App.h', 'src/App.c',
'src/Emulator.h', 'src/Emulator.c',
'src/Mapper.h'...
3
votes
0
answers
71
views
Correct I2C sequence on STM32F1 for reading 2 bytes?
I'm trying to interface between and stm32f103 and a light sensor using I2C using the Lower-Layer libraries. I have to read 2 bytes of data from the sensor and I'm using the sequence of register writes ...
1
vote
1
answer
98
views
glibc startup code appears to overwrite stack variable when debugging with GDB + ASAN
I am debugging a C program on Linux (x86_64) using GDB and AddressSanitizer. I have a stack variable:
struct file_ctx ctx;
memset(&ctx, 0, sizeof ctx);
I set a hardware watchpoint on the ...
1
vote
1
answer
99
views
Failed to read variable with KSEG1 address in MIPS32
I am working on an embedded RTOS system, where the CPU is a MIPS32.
The GNU ld.script specifies the final binary runs from 0x80000000, I think it is KSEG0 address space.
I wrote a test to read ...
3
votes
1
answer
149
views
Do compatible types have the same representation?
Furthermore, is the sizeof guaranteed to be the same on compatible types?
I expect the answer to both of these questions is likely "yes" in practice, but I don't see anything in the standard ...
Best practices
0
votes
1
replies
95
views
How to pass large arbitrary data to opengl shader
I have an array of simulation states that I want to pass to a fragment shader. In this scenario each state element should result in a pixel on the screen.
In order to decide what the color of the ...
4
votes
2
answers
220
views
C promotions confusion: signed/unsigned vs Windows/Linux
I found this code on GitHub and realized the hard way that it works on Windows, but not on Linux.
#define HASH_CONSTANT 2654435769
uint32_t fibHash(uint32_t hash, uint32_t shift) {
return (hash * ...