Skip to content

How can I stop the while?

I have A TCP Server-Client where I enter a number with the number of times that I want to send the word to the server. So I send correctly because I print the information on a loop(in client) but in the server shows infinitely because I put while(1) but if I don’t use just print it one time. I don&#8217…

How to insert char in mathed lines in a file

For example, I have a file with the content: I want to add “_1” in all the lines with “a : “, and get the result as: Are there any ways by bash commands Answer Your spacing is unclear, whether you have “a : …” or “a: …”. You also have what appears si…

Shell script: Using own IP adresss as variable

I have to write a shell script which initializes docker swarm. I need to pass the own IP address as argument: How can I do this dynamically? I know the ifconfig command, which allows me to see the IP, but I can not pass the whole thing as variable. It should look like this Answer The following command will re…

What is “(void*)-1” in the context of sbrk’s return value?

The Linux Man Page for sbrk() states that upon failure, it returns (void*) -1. What is (void*) -1 and does it have any significance or is it simply a number that could never actually be a void* which is cast to a void* just to meet the function signature of returning a void*? I ask this because I’ve nev…

How to get supported display refresh rates on Linux?

drmModeModeInfo structure from DRM contains uint32_t vrefresh; field, and the values are actually good there i.e. I’m getting 24-75Hz for different video modes. But refresh rates aren’t integers, they’re rational numbers, right now for my display the value is 59997/1000. Is it possible to get the precise numb…