Skip to content

Tag: c++

Rename generated files in Makefile

I have to modify a Makefile such that the intermediate files with extension .cc are moved to .cpp before building the .o. files. My modified Makefile looks like below. protoc is a compiler that generates .cc files. How to make targets so that after generating the .cc files those are move to .cpp and then the …

C++ get source file directory in Linux

This question is many time asked and I referred all, but I need bit different. I am using macbook -> Clion (IDE) for C++ My program file location /Users/Kandarp/ClionProjects/SimulationParser/main.cpp When I use following function for get current directory it gives different file (I think actual path where…

how to alternate continously Signal handler

I want to write a program in c for linux that catchs the first SIGUSR1 signal, ignores the second one and continue in this behaviour (catch-ignore) for the successive SIGUSR1 signals. I wonder how to keep alternating between the two handlers, because once i set the handler to SIG_IGN, the signal will be ignor…

2 program get same udp packets from a port

there is a server will send some UDP packets to my localhost, for example: if it send some UDP packets to my localhost and destination port is 5000. and there will have a client program to receive it on port 5000. but, what I want is to create another program, it will try to receive the same packets on port