I want to copy data from one stream to another. Now normally, I would do it this way:
n = fread(buffer, 1, bufsize, fin);
fwrite(buffer, 1, n, fout);
Is there a way to write the data directly from fin
to fout
, without going through a buffer, i.e. instead of fin->buffer->fout
, I want to directly do fin->fout
(no buffer).
Is it possible to do so in ANSI C? If not, is it possible to do it with POSIX functions? Or a Linux-specific solution?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…