Undefined behaviour?
Type: Posts; User: heatblazer
Undefined behaviour?
Hello,
I am reading a code, that is working, but I think it's wrong, and it should crash, but it does not. It merges Array1 into Array2 if there is enough space in Array2 to fit it, but first...
Hello, it`s not exactly C/C++ related even though written in C/C++. It`s an algo to draw a triangle but I am missing one draw iterration.
static void set_char_at(char* mat, int cols, int x,...
Hello, I am interested if that trim function is OK to be used, with no leaks possible.
static void trim(char* data)
{
char* begin= data;
char* end = &data[aux_strlen(data)-1];
...
Hello, I am trying to complete a finite IPC machine. For some unknown reason to me, mkfifo never succeeds. My first few atempts, it does after that it always return a non-zero value (which by the...
Thanks, I`ll consider it.
Also my repo is here
GitHub - heatblazer/unix-ipc: inter proc communication
anyone who wish to give me a hand is welcome.
I was thinking of 3rd program which is the bridge between the two. The sender sends some data, the bridge has the function to work on it, let`s say it populates a struct with char data and return...
That is bad :( Ok what if I made an auxilary .o file that is passed to both sender and receiver?
Hello,
I am playing with the linx FIFO and mknod. As simple example as opening two programs "sender" and "receiver", and a FIFO between them, it seems that they can exchange buffers. However the...
I`ve found a way to restore the object via the cast from the buffer:
After reading the object to a char buffer with a sufficiet size:
struct a* pa = (struct a*) buff;
Also the serialize...
Hello, I am trying to serialize a simple C struct. I am dumping it to a file then try to read and restore it. However I got wrong data. Here is my idea:
#include <stdio.h>#include <stdlib.h>...
Hello,
I have the following code, which I intend to recieve messages form a server but for now it recieves only on send.
linux-daemon-interface/network at master *...
Hello, I am experimenting with a lock free simple list for inserting data:
#include<stdio.h>#include<stdlib.h>#include<pthread.h>
typedefstruct_n{intdata;struct_n*next;}node;...
Hello,
actually I had a wrong iterator for printing the list, but thanks for the reminder of the joining the threads.
//node* it = (&s_head);
node* it = *(&s_head);
I was iterating to...
Hello,
I am trying a multithreaded code but I am recieving sigtrap. I am trying to test a round robin algorithm but somehow I am SIGTRAPing in the atomic_push function.
typedef struct...
I`ve heard also about offsetof macro which can be used to acces N-th member of the struct but how can I achieve this via a raw buffer, that comes from the pipe?
Hello, first I want to ask if it`s possible to call a remote procedure via FIFO pipe from unix with standart FIFO producer/consumer algorithm?
Here is my daemon implementation:...
Hello,
I am trying to start a test daemon but setsid keeps failing.
/*pass main`s args here */
int start(int argc, char** argv)
{
//test interface
(void)...
Hello,
I need to determine which device has been connected to a linux system, and with what order the devices are connected. Like if DEV1 is connected to SLOT1 it`s OK, etc. However, I don`t want...
Let`s say I need two instances of that class form pjsua2: 4. Endpoint — PJSUA2 Documentation 1.0-alpha documentation
Hello,
I have a class that is a singleton. However I need more instances of that class, so I am interested do I have to rewrite the class, or I can adapt it to loose that functionality whithout...
I do agree with your solution. Thanks :)
I`ve written a simple type universal macro that swaps int 16 or 32 also floats with no problem at all and works for my problems:
#define ENDIAN_SWAP(Type, Var) \
{ ...
Fixed the swap error but still not swaps
eswap.c[0] = (eswap.c[0] >> 8) | eswap.c[0]<<8 );
...
I though that the union and the char array will be in the same address so I can acces 4 8...