Category "c"

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

Multithreaded socket programming : sharing variable

Hi I want to implement a ring of sockets .For example IP address 127.0.0.1 listens to 127.0.0.3 and this one listens to 127.0.0.2. They are supposed to share so

Why is my if block not getting executed in my C program?

Why is the if block not executed in the code below? #include <stdio.h> #include <stdlib.h> int main() { printf("--------------------------------

What is cryptic line of code for this statement? [closed]

For example: temp->next = NULL is same as (*temp).next = NULL list->next->next = temp is same as ??

Why is if (2 < 9 < 3) true?

This was a question in my preparation exam: int val = 0; int x = 0; int y = 1; if (x < val < y) printf(" true "); else printf(" false "); Why is

What are the examples of non-ISO practices, which are not found by -pedantic?

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html : Some users try to use -Wpedantic to check programs for strict ISO C conformance. They soon find that

Recursive Function using MPI library

I am using the recursive function to find determinant of a 5x5 matrix. Although this sounds a trivial problem and can be solved using OpenMP if the dimensions a

How kernel know which driver to be called when we are calling any socket from user-space?

I am using IWD as a wireless daemon in userspace. Driver and firmware are loaded. When the socket is called by IWD using nl80211, it passes to nl80211 and than

What is the most efficient way to copy many files programmatically?

Once upon a time long ago, we had a bash script that works out a list of files that need to be copied based on some criteria (basically like a filtered version

How to divide two unsigned long 64 bit values in x86 assembly and then returning the quotient and remainder to a C program

In a separate C program, I have passed 4 parameters to an x86 ASM program. dividend divisor Quotient pointer Remainder pointer dividend = 0xA divisor = 0x3 Whic

Insert and Delete element on Circular Queue

I'm studying about circular queue in data structure . As you can see from the code below, I try to delete a specific data and insert data on Circular queue. How

Python Ctypes - loading dll throws OSError: [WinError 193] %1 is not a valid Win32 application

I have tried to run an exemple of a python code that gets a function from a library using ctypes. The exemple can be found here. I followed the instruction and