407,763 questions
0
votes
0
answers
7
views
PDF Sign e-token: The document has been modified or damaged since Signature was applied
I'm trying to sign a PDF with an e-token, but I'm getting the error
"The document has been modified or damaged since Signature was applied."
I have tried with different pdf files, and also ...
0
votes
0
answers
16
views
CMake add link_libraries and include_directories to single file based on platform target
I have a cmake based C project for which I compile both for host and for target. I have the following project structure:
root\
- app-cpu1\
-- src\
-- inc\
-- test\
- app-cpu2\
-- src\
-- inc\
-- test\
...
2
votes
1
answer
63
views
How To Legally Access Union Array [duplicate]
Suppose I have a type punning union, e.g.
typedef union {
uint64_t ulong;
uint32_t uint[2];
} myunion_t;
and I make an array with these as elements. e.g.
myunion_t myarray[3];
If I want to print ...
-2
votes
0
answers
71
views
xor example tensorflow C api
Simple xor functions. How load model using https://www.tensorflow.org/install/lang_c .
#!/usr/bin/env python
import numpy as np
import tensorflow as tf
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], ...
1
vote
1
answer
83
views
Starter FreeRDP Script in C
I have been trying to get started with establishing RDP connections using FreeRDP and after a lot of effort looking at their codebase was able to write a simple script in C.
// main.c
#include <...
1
vote
0
answers
34
views
How to send sk_buff to Linux Network stack as package received from TAP
I'm trying to send sk_buff from one driver to RX queue of other (TAP, drivers/net/tun.c in Linux sources), using code like this:
#if RECV_SKB
#define NETIF_RX netif_receive_skb
#else
#define NETIF_RX ...
0
votes
3
answers
198
views
How I use C programming structs without pragma pack
I am just starting with C language.
I get an exercise to do where I need to read and save a generic struct
It has a descriptor.
I can't use pragma pack and I can't use hard coded name fields into ...
-3
votes
0
answers
32
views
Networked File Synchronization System [closed]
I want make client and server to sync file between each other , Now through socket I received (server) from client information about files my problem how I can distinguish if these name file or the ...
6
votes
4
answers
170
views
Get maximum of enum in pure C
Assuming I have a code like this:
#include <stdio.h>
// A numbered enum with gaps
#define COLORS(X) \
X(RED, 10) \
X(GREEN, 2) \
X(BLUE, 5) \
X(YELLOW, 7)
typedef ...
1
vote
1
answer
95
views
Casting a pointer to the type of the first member of a structure vs. a union [closed]
I encountered the manifestation of UB (strict aliasing) when debugging code under ARM (ARM CLang compiler). I compile at level -Os balanced + LTO. I have the following structure:
typedef struct {
...
0
votes
1
answer
60
views
how to link c file in Ada with gnatmake?
good, I'll get straight to the point. I have a program that needs to run tasks. These three tasks communicate with each other and call C functions for their needs. I wrote functions that call C ...
0
votes
0
answers
115
views
Effects of fread()-ing a file in 1B vs 1MB vs 4MB vs 16MB chunks? [closed]
I want to know what would be the optimal chunk size to use on fread to get best performance and not waste any memory.
I would assume that specifying the chunk size to be the same size as max internal ...
1
vote
1
answer
98
views
error: impossible constraint in 'asm' with -m32 for an "i" ("string") operand: string address as immediate
I am just wondering why this code:
void test(void) {
asm volatile( "ud2\n\t"
".long " "%c0" "\n\t"
".word %c1\n\t&...
-1
votes
0
answers
90
views
RESOLVED Why is my custom GetModuleHandle function returning a truncated pointer on x64? [closed]
I'm trying to implement a custom version of GetModuleHandle that takes a hash of the module name and returns the base address of the loaded module.
Here is the code:
PVOID GetModuleHandleH(DWORD ...
0
votes
0
answers
102
views
Why aren't my struct values persisting when assigned in another method? [closed]
I'm learning about HTTP servers through some coding challenges that involve accepting client connections, parsing request headers, building and sending response headers, etc. and most of it's been ...