Hi, My application is developed using C and running on Linux.
A process has a char buffer(4096 bytes) which contains a log statement which is a comma seperated string of the following information: loglevel, errorlevel, Module name, function name, description of the error etc. (Variable length string and can go upto 4096 characters) Now my requirement is to send this comma seperated string to a different process through a FIFO. My doubt is, 1) is it better to use write(fifofile,buffer,4096) or 2) should i use any other function like fputs or fwrite(fifofile,strlen(buffer))? If i go by option 1, i would read 4096 bytes safely at the reading process. Also it is equal to the PIPE_BUF so, the process wont be interrupted by any signal upto PIPE_BUF size. But i am not sure whether this is an efficient way, because we are reading/writing lot of unnecessary characters. Buf if I do Fwrite(strlen(buffer)), while reading from FIFO i am not sure how many bytes to look for. I cannot use fgets because it might stop reading if it sees a new line, and it would become difficult if the log statement itself contains a new line in between. Please guide me with the proper function to read from or write into a FIFO. Thanks, Sathya [Non-text portions of this message have been removed]
