是否可以在Octave和子进程之间增加popen2中使用的缓冲区?看起来缓冲区限制在大约66560字节。此代码段显示了问题:
## This works with s = 65
## but not with s = 66
s = 66;
[in, out, pid] = popen2 ("dd", {"if=/dev/urandom",
"bs=1K",
sprintf("count=%i", s)});
pause (1);
[vt, cnt] = fread(out);
assert (cnt, s * 1024);
waitpid (pid);
fclose (in);
fclose (out);
返回:
66+0 Datensätze ein
66+0 Datensätze aus
67584 Bytes (68 kB) kopiert, 0.999523 s, 67.6 kB/s
error: ASSERT errors for: assert (cnt,s * 1024)
Location | Observed | Expected | Reason
() 66560 67584 Abs err 1024 exceeds tol 0