Skip to content
Advertisement

Tag: c++

Playing with shmat and shm_open

I just read the manpages for shm_open and shmat and was trying out the following example. In a file test.c I do, And in a wrapper file I do, I tried adding in a strerror(errno) at test.c and I get Identifier removed. What does that mean? What am I doing wrong? Given a shared memory identifier(shmid), shouldn’t I be able

Interpreting STRACE output – pipes and forks

I have the following code written in C, taken from https://beej.us/guide/bgipc/html/multi/pipes.html: When compiling and running this code in the terminal using strace I get the following output: Can anybody explain, line by line, what is going on in the strace output? I’ve attempted to research how to interpret strace outputs but haven’t had any luck. Thanks in advance. Answer The

I read more than I write in file

I have a file, partitioned in fixed sized blocks. I am copying a test_file.txt into the 3rd block of the file. I read and copied 18 bytes. Then I am trying to copy from the file that very same .txt file I just imported to a newly created .txt, but I am writing 256 bytes to the new file. Moreover,

system call open() creating executable

So my code creates and writes to the out_file properly. However, the file is an executable for some reason. I think the fault is in my open() call but I can’t seem to find why. Answer man 2 open explains why: So if you want a file that’s not executable, you can use: 0666 will suggest read/write for all (equivalent

Errors opening a file in c

currently I’m having problems with the function below trying to open a file, no matter what I give it the function can’t seem to open the file. I’m currently passing in “./input.txt” which is a file in the same directory as the executable. Is there anything blatantly wrong with the code that you guys can see? Answer You are returning

Bulk message transfer USB Linux

I am at the very beginning to write my own Linux Driver for a dds generator. I want to write 2 bulk messgages to the generator when der Kernel call the probe function. But I dont know how to call the usb_bulk_msg function. I hope you could me. hsync Answer Kernel is kinda self-explanatory project, so usually you can find

Programmatically monitor process state using C++

I have to develop an application in C++ to monitor the state of processes in my Linux system and also need to know if a new process is created or an existing process is terminated. Is there an API available for this? Also it will be helpful if someone could tell me how to start it with. Answer inotify works

Communicate with a subprocess using pipes on other than stdout/stderr

This is how I fork/exec a subprocess and communicated with it (pseudocode): My question is: I don’t really want to read the stdout of my subprocess, I would like the subprocess to write on a file descriptor other than stdout. And, I’d like the above code to read from that file descriptor. The subprocess is written in python, the main

Advertisement