Category "c"

What is the difference between using INTXX_C macros and performing type cast to literals?

For example this code is broken (I've just fixed it in actual code..). uint64_t a = 1 << 60 It can be fixed as, uint64_t a = (uint64_t)1 << 60 but

OpenVAS libgvm_util.so: undefined reference to `MQTTClient_`

Have some troubles in compiling from source https://github.com/greenbone/openvas.git cmake was done successfully, but make failed with: /usr/bin/ld: /opt/gvm/li

Having problem Understanding fork() hierarchy tree

I have this Code that I can't understand. I understood the basics of fork() but I don't understand the Hierarchical tree for this process. The code is like this

OpenSSL BIO_read is wrong

This is the code how I am reading the response from my HTTPS request: int len = 0; f = fopen("response.txt", "wb"); do { char buff[1534]; len = BIO_read

why does malloc not taking in the full text? [duplicate]

Why is it when I try to take in a text in the variable is does not store in the full sentence. The malloc seems to not allocate enough memory

c program doesn't takes "space" as input to show the acsii code

The program shows output for all other characters instead of space. When I enter "space" it doesn't do anything and just waits. #include<stdio.h> #include

Linux getenv() could not get $PS1 or $PS2

My home world is to write a shell. and I must use $PS2. but when I write a code like this: char *ENV_ps2; ENV_ps2 = getenv("PS2"); I just found ENV_ps2 was

How to delete or clear all the messages from the POSIX message queue in c?

I want to delete all the messages from the POSIX message queue. I searched on the internet but I didn't find any way to do it instead I found the way to delete

What value does the compiler assign to an uninitialised member of a const struct in C?

Say I have a struct typedef that is: typedef struct { int32_t memberOne; int32_t memberTwo; } myStruct_t; I instantiate a const of that type as follows

Why does GCC include an "empty" XOR

I have following piece of code: typedef struct { int x; int y; int z; int w; } s32x4; s32x4 f() { s32x4 v; v.x

does pthread_join affects concurrently

I want to run all threads concurrently. If I use pthread_join function does it affect running of threads concurrently? pthread_join(..)

What is the first parameter of curl_easy_escape for?

The curl_easy_escape function of curl takes a CURL* as its first parameter, as curl’s documentation indicates: char *curl_easy_escape(CURL *curl, const ch

Adding a tab in a GTK-Notebook when using Glade

I have written a C-program and am studying GTK and Glade to build a GUI and now I am stuck for at least two days: I need a notebook with one tab. In this tab i

What is the difference between these two code structure? Nested vs single line code

if (x>0 && x<6) { break; } else if(x>6) { break; } versus if (x>0) { if (x<6)

c port listener client disconnects after 1 message

I did create a program that listens on a port and prints the message out on the terminal. My problem is, that I want to connect with telnet (telnet localhost 13

Draw a GtkImage with Cairo

I tried the solutions proposed in similary notes (How to create a gtkimage from a cairo context, How do I create a gtkimage from a cairo surface) but they didn'

Program behaves different when running with Valgrind

I have a problem debugging my application with Valgrind (memcheck). It behaves differently than when I run it standalone. There is a place in the code where it

up to 20% Numerical error or Bug in ten line code block [closed]

Rewriting a single tiny block of code of an application has yielded a considerable performance improvement. The code is 100% sequential, thus

Function-like macro, 'REPORT_ERROR', defined [MISRA 2012 Directive 4.9, advisory]

I have defined the MACRO, which will call the function and pass the argument. Getting below MISRA warning for this case. Is it not allowed? How to avoid this?

PThreads is not providing a program speedup over serial code

I am creating 2 programs to test the differences in run time of serial matrix multiply vs that of parallel matrix multiply. The parallel code that I have writte