are there way write directly disk without cache in c++? using:
int open(fileout, o_create | o_wronly | o_direct); file *fh = fdopen(fileout_dev, "wb");
are there cross platform libraries allowing that?
thanks arman.
if you're talking buffering, can use setbuf or setvbuf
/* setbuf example */ #include <stdio.h> int main () { char buffer[bufsiz]; file *pfile1, *pfile2; pfile1=fopen ("myfile.txt","w"); pfile2=fopen ("myfile2.txt","a"); setbuf ( pfile1 , buffer ); fputs ("this sent buffered stream",pfile1); fflush (pfile1); setbuf ( pfile2 , null ); fputs ("this sent unbuffered stream",pfile2); fclose (pfile1); fclose (pfile2); return 0; } /* setvbuf example */ #include <stdio.h> int main () { file *pfile; pfile=fopen ("myfile.txt","w"); // _ionbf disables buffering setvbuf (pfile , null , _ionbf, 0); // file operations here fclose (pfile); return 0; }
Comments
Post a Comment