Is there a way to read C / C ++ from a socket using read () and have a receive buffer as a file (from a stream) or a similar self-propagating object (vector, for example)?
EDIT: A question arose while I was thinking about how to read a stream socket that can receive the contents of a file, say, 10000+ bytes. I just never wanted to put 20,000 or 50,000 bytes (big enough at the moment) on the stack as a buffer, where the file can be stored temporarily until I can insert it into the file. Why not just transfer it directly to a file to start with it.
How can you get the char * inside the std line: I thought of something like
read( int fd, outFile.front(), std::npos );
or something like that.
end edit
Thank.
source
share