I wonder if read function does allocate the Buffer size to the Buffer that passes to it or not? I need to know that in order to see if I need to free the Buffer or not after I am done with it.
Here is the prototype of the function read :
ssize_t read(int fildes, void *buf, size_t nbytes);
No, read does not do any allocation. It reads data into the buffer you provide as an argument, which must have been allocated by you prior to calling read. You can use a buffer on the heap or stack, or a global buffer; its your choice.