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,341
questions
0
votes
0
answers
6
views
Zephyr os mqtt tls thingsboard : mqtt_connect fails with return -2
I am trying to connect to mqtt.thingsboard.cloud server with mqtt tls protocol but I encounter the following error :
00:00:18.056,000] <inf> net_mqtt_publisher_sample: Attempting to connect to ...
0
votes
0
answers
6
views
I'm working on imx8mp board, and I want to get the os information from the board. How can I do that in c language?
I'm working on imx8mp board, and I want to get the os information from the board. How can I do that in c language?
Create a program to get network information and OS info of the board (e.g IP address, ...
0
votes
0
answers
19
views
Calling outer program which accesses I2C device with system( ) in Linux, does not work
first at all, I list the environment below.
Hardware: Raspberry Pi Zero 2w
OS: Raspberry Pi OS (Legacy) Lite
USED Interface: UART, I2C
The scenario is that I wrote a UART server in C to receive ...
0
votes
0
answers
6
views
MCUXpresso with MQX 4.2 : Kinetis MK64FN1M0VLQ12
I'm compiling an old Code Warrior v10.6 (Freescale) project with MQX 4.2 in MCUXpressov11.9.1 (NXP). I want to continue to use MQX 4.2 in MCUXpresso. I can't resolve the following error on the MQX ...
0
votes
0
answers
28
views
Are enums appropriate for masks?
Since mask values are integers we can represent them in different ways. For example, as macros:
#define ENABLE_FEATURE_A 0x1
#define ENABLE_FEATURE_B 0x2
#define ENABLE_FEATURE_C 0x4
#define ...
0
votes
0
answers
11
views
Finding server port In RTSP server base on RTP with UDP transport
I want to find out Server port is RTSP server with Gstreamer when UDP is selected as Transport. This my source code it just shows Client port not server port(server port is shown = -1).
#include <...
0
votes
0
answers
19
views
execve system call returning an unexpected output
So I've been working on a mini project in C about piping and processes in Linux.
A program is executed like this:
./a.out "file1" "cmd1" "cmd2" "file2"
It ...
0
votes
3
answers
50
views
Error in assigning values to memory location with for loop [duplicate]
I have just entered the world of C programming, and I'm currently learning how to use malloc & free.
I've written a short excercise code to printf the string entered with scanf, and I am having ...
0
votes
0
answers
19
views
How to set background color of selected text of GtkText widget with css?
I am facing issue to set background color of selected text in GtkText widget. I tried this way, but it didn't work!
can anybody check it ? --
static const char *css =
".one text.selection {"
...
0
votes
1
answer
34
views
Returning memory allocated inside a function to another function [duplicate]
In the program below, the function getcc() returns pointer to a char array that was allocated inside getcc(). When I pass that pointer in printf with %s format specifier, it does not print anything.
#...
0
votes
0
answers
35
views
CSV parser incorrectly handling decimal numbers in matrix construction
I'm working on this cool text analysis project where I'm reading in phrases from a CSV file and building a matrix to analyze word transitions. But I've hit a snag with how my program handles decimal ...
2
votes
0
answers
63
views
Primes using setjmp
I wrote a simple Haskell function, that gives a list of primes.
primes' :: [Int] -> [Int]
primes' (p : xs) = p : primes' (filter (\x -> x `rem` p /= 0) xs)
primes :: [Int]
primes = primes' [2 .....
1
vote
1
answer
58
views
What is the difference between these two functions in x64 assembly?
I'm playing around with lower level stuff in C on Windows (x64) to try and learn low level concepts. I ran across something I don't understand and just wonder if someone could explain something to me....
1
vote
0
answers
16
views
How to clear the receive buffer in a serial bus (SERDEV) kernel driver
I'm writing a very simple linux kernel driver for my serial keyboard, employing serdev. The driver works and the function
static size_t serdev_keyboard_recv(struct serdev_device *serdev,
...
1
vote
0
answers
13
views
cimport cython module that wrap c libraries
I have this kind c/cython project :
project/
├── src/
│ └── modules/
│ ├── cython1.pyx
│ ├── cython1.pxd
│ ├── cython2.pyx
│ ├── cython2.pxd
│ ├── includes/
│ │ ...