Questions tagged [c]
C is a general-purpose programming language used for system programming (OS and embedded), libraries, games, and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc.). C is distinct from C++, and it should not be combined with the C++ tag without a specific reason.
405,629
questions
0
votes
0
answers
14
views
Receiving and Sending J1939 CAN message on Linux in C
I am trying to open a SocketCAN J1939 and receive and send J1939 messages. I am very confused with type "sockaddr_can". This structure has j1939.addr, j1939.pgn, j1939.name etc. When I ...
0
votes
1
answer
56
views
Passing `volatile` buffers to library functions which do not take `volatile`
I have a multi-processor system with a "shared" memory region used for communication. In some cases one of the processors needs to process some considerably large data in the shared memory ...
2
votes
0
answers
67
views
malloc fails even with enough memory
I'm implementing a SkipList for academic purposes in C.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// ===============================================
// SkipList
// ===...
1
vote
0
answers
38
views
Unable to access server running in k8s pod from WSL host with docker-desktop installation
I'm running docker-desktop with WSL2.0 ubuntu on windows. I created a k8s deployment in the wsl ubuntu host. The deployment has one pod where I'm running a simple server program(runs forever, accepts ...
1
vote
0
answers
40
views
Adding attributes to entire c-file instead of specific function
Hi I was trying to add the attribute __attribute__((section(".protected"))) to my whole c file. My temporary solution was to just give this attribute to main() and put all the variables ...
1
vote
1
answer
38
views
iconv: Invalid argument error when passing struct element
I have a function which converts utf-16 string to utf-8 by using iconv library (ignore "ISO-8859-1" part, my test files all are utf-8 and utf-16). Here is it's code:
char* to_utf8(const ...
3
votes
1
answer
56
views
In R, how and where does the underlying C functions get their argument inputs?
I'm trying to understand what happens at the C level when I call a function in R. For instance, print("Hello, World!") will call UseMethod("print"). From the "table" in ...
0
votes
0
answers
34
views
TCC & CLion errors
I've setup successfully the CLion + TCC enviroment on the windows 10 machine. My colleague asked me for help with that so I shared the CLion project and he:
unpacked the TCC in the right directory,
...
1
vote
0
answers
39
views
How to handle error creating threads in a loop
I'm into the Philosophers project, it is about handling threads and mutexes. For the project I need to create several threads, each thread runs a routine function and accesses shared resources. I ...
1
vote
1
answer
78
views
C serial communication, Why does read() lose some data bytes at high baud rates (e.g., B921600)?
Question:
I am implementing a C program to communicate between two serial ports on the same machine. The setup involves two serial ports connected via a Null Modem adapter, and I am experiencing an ...
0
votes
0
answers
59
views
How do I properly call OpenGL 3.3 functions in Fortran?
For some reason, I am trying to run OpenGL 3.3 in Fortran. I'm having trouble calling glGenBuffers().
Note that glewInit() returns 1. I tried to set the glewExperimental = 1 flag, but with no ...
0
votes
1
answer
27
views
problem with cs50 p-set3 runoff (print winner funtion)
so this is a problem from CS50 Week 3 runoff, when I am running this code I am getting the following error, I cant understand why?
I don't find any problem with the code, so need help from more ...
0
votes
0
answers
64
views
Why, how, and when to write POSIX compatible code? [closed]
Disclaimer: I thought this question was a factual question but SO marked it as opinion based. I re-wrote it below so hopefully people can answer with factual information about CLI tools in C.
I just ...
0
votes
1
answer
37
views
How do I detect when an AIO operation finished without spinning?
In C you might be able to use AIO to do IO in the background without hanging if the IO takes a while, and without the unnecessary creation of threads.
But is there a way I can put a callback function, ...
3
votes
1
answer
91
views
z/OS zero length side deck file generated, no warnings displayed
I'm trying to compile an executable on z/OS. The final step fails with a handful of undefined symbols. Presumably this is because the step before it that is generating a .so also generates a zero ...