I’ve got a trouble and can’t google out solution, so I hope you’ll be able to help me. There is a client-server application, something like text chat. Server accepts client’s connection, makes new socket for client and sends socket descriptor to it’s child process, that broadcasts received messages to all connected clients. server.c (error handling and tests are cuted out)
Tag: c++
Programming in Linux – FIFO
I have created fifo, try to write to it: echo “text” > myfifo and read it with my programm. But when I write to fifo nothing shows. I have tried many options, turning off and on NON_BLOCK mode and so on but nothing seems to help. Answer This needs to be (there’s probably no need for the O_NONBLOCK flag, but
How to read some specific lines in a file, and print them in console in Linux C programming
I write two new lines in a file. The new lines are appended to this file. How can print these two new lines to the console. Could you please give me some examples about this? The process is below: fd = open(file , O_WRONLY | O_APPEND, 0666); ret = read(0, buf, 100); write(file, buf, strlen(buf)); The problem is 4th process.
Why are the values in my dynamic 2D char array being overwritten?
I’m trying to build a process logger in C on Linux, but having trouble getting it right. I’d like it to have 3 colums: USER, PID, COMMAND. I’m using the output of ps aux and trying to dynamically append it to an array. That is, for every line ps aux outputs, I want to add a row to my array.
Reading corrupt file, segmentation fault
I run my program by passing it a bunch of directories like this: Each directory is a separate set of files that I am parsing for data which I then create into a spreadsheet. Each directory is a different row of the spreadsheet. I want to only put reliable data in the spreadsheet and so if an entry is missing
Segmentation fault (core dumped) in c using linux – special case
I am basically trying to create a log file which has date and time as its name. This is my code Without the step 1 every thing worked fine. It created a log file with the name I wanted in the same folder where my program is. But when I add step 1 into the mix it gives me this
How to get the first address of initialized data segment
my program is working on linux using gcc. Through the manual page, I find edata, which represent the first address past the end of the initialized data segment. But I want know the first address of initialized data segment How can I get it? I have tried treating etext as the first address of initialized data segment. Then I got
“Alarm clock” message on linux
I’m working on a project written in C and I’m using alarms. In the beginning of the code I use sigaction() to initialize the alarm: Then I call the alarm with the alarm() function in a loop: The program sends the first alarm and runs the handler function, but when he sends the second one a message appears on the
delay output in c++ on linux
I want some random characters to be printed to console and then deleted by “b”. After this I want to put my own variable so it will be looking like “randomizing”. The problem is that it is happening too fast. I wanted to delay the output by using usleep or sleep function but when I’m using it, nothing is printed
OpenSSL verify_callback and SSL_connect
The SSL_CTX_set_verify() and SSL_set_verify() calls can be used to set the verify_callback() function for the underlying context and ssl, respectively. Here is a snippet from the documentation of verify_callback(): The return value of verify_callback controls the strategy of the further verification process. If verify_callback returns 0, the verification process is immediately stopped with “verification failed” state. If SSL_VERIFY_PEER is set,