Does anyone know how to set an int file descriptor buffer to no buffer and to flush immediately? I’ve tried to use setvbuf but it takes a FILE* not int fd.
Kevin
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A file associated with an
intis an operating system handle.setvbuf()manages buffers with a C runtime libraryFILE.To prevent buffering, you would have to use the proper operating system specific function, which perhaps can be done when the file is opened. For example, on Linux
To flush data already written, use
fsync():