Category "c"

how to convert int to void *?

I'm trying to make an analogue of sscanf with a specifier %p. I use this: int res = ahex2num(buf); *va_arg(ap, void **) = (void *) res; It works correctly, i a

why child can't send signal to parent

parent: volatile int signalval = 0; void signal_handle_c(int sig_num) { printf("child SIGUSR1 ok\n"); signalval = 1; }; int main(int argc,char**argv){

Openssl 3.0. Rsa private methods not called

Recently I have migrated my app from OpenSSL 1.0 to OpenSSL 3.0. And now my connection is not working anymore. The methods which perform private encryption and

How to call a C function from Java 17 using JEP 412: Foreign Function & Memory API

Does anybody have a simple example on how to call a C function from Java 17 that includes creating a C library and how to setup a MethodHandle? The JEP descript

Why is the XOR swap optimized into a normal swap using the MOV instruction?

While testing things around Compiler Explorer, I tried out the following overflow-free function for calculating the average of 2 unsigned 32-bit integers: uint3

Thread safe random number generator in c

Does the c standard provide a thread safe random number generator where instead of using a global state the generator uses and modifies the provided state buffe

C : why is that cast of void function to "pointer to function returning pointer to pointer to void" possible

#include <stdio.h> void hello() { printf("hello world\n"); } int main() { void *(*gibberish)() = (void *(*)())hello; (*gibberish)(); voi

What calling convention does printf() in C use?

So I've been practicing to write simple subroutines in FASMW using the CDECL and STDCALL calling conventions and it got me wondering about what the printf funct

Returning dynamic memory inside a struct in C

Hi I have the following struct typedef struct mystruct_s { int* array; } mystruct; and I want to create a function that initializes it. I have two ways of

Trouble passing a C# string from userland to kernelmode C and using it to find specific LDR_DATA_TABLE_ENTRY

I am having difficulty comparing a string passed from usermode type LPWSTR to a LDR table entry type UNICODE_STRING Kernel C: struct { int pid; int user

What is function designator and actual call?

According to C99 Standard: The order of evaluation of the function designator, the actual arguments, and subexpressions within the actual arguments is unspe

Generic function typedef in C - how to get rid of initialization warning?

I'm experimenting with generic-like code and I have a function like this (a lot of not relevant code removed): typedef uint8_t (*struct_converter_t)(void *, cha

How to use FT_RENDER_MODE_SDF in freetype?

I'm quite new to font rendering and I'm trying to generate signed distance field with freetype so that it can be used in fragment shader in OpenGL. Here is the

Generic function typedef in C - how to get rid of initialization warning?

I'm experimenting with generic-like code and I have a function like this (a lot of not relevant code removed): typedef uint8_t (*struct_converter_t)(void *, cha

How to use FT_RENDER_MODE_SDF in freetype?

I'm quite new to font rendering and I'm trying to generate signed distance field with freetype so that it can be used in fragment shader in OpenGL. Here is the

Compilation of nginx fails due to struct 'crypt_data' has no member named 'current_salt'

I am trying to compile nginx on Ubuntu machine with GCC. My Glibc version is 2.31. m@feynman:~/Junk/nginx-1.9.9 $ /lib/x86_64-linux-gnu/libc.so.6 --version GNU

Can I change the default linker script/flags of ld?

I am using a software, which modifies some bytes in an executable. I don't know what it does exactly, but I use it for license protection of the already built b

A question about returning local pointer variable in function

I know the variables in function are using stack space. When function exit, the space are freed. That's why we should declare the pointer variable as static in

is there a way to use fgets size dynamically

So im learning about pointers and dynamic memory and how am experimenting with fgets. So i want to take in a string input into a pointer using fgets, but i want

C program How to get return value from other function by using switch statement

So I am trying to do a program where it shows a menu and asks what will the user do. I am stuck in where I cant get the return value in case 1 and use it in cas