buffer

Pipe buffer size is 4k or 64k?

孤街醉人 提交于 2019-12-17 06:27:48
问题 I read in multiple places that the default buffer size for a pipe is 4kB (for instance, here), and my ulimit -a tends to confirm that statement: $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 15923 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 // 8 * 512B = 4kB POSIX message queues (bytes, -q) 819200 real

What does flushing the buffer mean?

試著忘記壹切 提交于 2019-12-17 05:37:57
问题 I am learning C++ and I found something that I can't understand: Output buffers can be explicitly flushed to force the buffer to be written. By default, reading cin flushes cout ; cout is also flushed when the program ends normally. So flushing the buffer (for example an output buffer): does this clear the buffer by deleting everything in it or does it clear the buffer by outputting everything in it? Or does flushing the buffer mean something completely different? 回答1: Consider writing to a

What does flushing the buffer mean?

家住魔仙堡 提交于 2019-12-17 05:37:11
问题 I am learning C++ and I found something that I can't understand: Output buffers can be explicitly flushed to force the buffer to be written. By default, reading cin flushes cout ; cout is also flushed when the program ends normally. So flushing the buffer (for example an output buffer): does this clear the buffer by deleting everything in it or does it clear the buffer by outputting everything in it? Or does flushing the buffer mean something completely different? 回答1: Consider writing to a

std::cout won't print

夙愿已清 提交于 2019-12-17 03:43:18
问题 Is there any circumstance when std::cout << "hello" doesn't work? I have a c/c++ code, however the std::cout doesn't print anything, not even constant strings (such as "hello"). Is there any way to check if cout is able/unable to open the stream? There are some member functions like good() , bad() , ... but I don't know which one is suitable for me. 回答1: Make sure you flush the stream. This is required because the output streams are buffered and you have no guarantee over when the buffer will

Another: Force Chrome to fully buffer mp4 video

不羁岁月 提交于 2019-12-17 01:07:27
问题 I've seen a few threads about this, but with no answers, so I thought I'd add another to the grave yard of polluted youtube related pages. I've got a 100MB mp4 video that needs to be fully downloaded by the browser, However theres no event that fires when its been fully downloaded, and Chrome seems to stop buffering any more of the video until the current video time has almost reached the end of the buffer, then it requests more. How can I get the browsers to fully download the video and

Uploading file with WCF streaming, tiny reads from stream

夙愿已清 提交于 2019-12-14 03:57:21
问题 I've implemented file uploading using WCF's streaming. Everything works as expected, however i faced one issue: i'm allocating 4kb buffer to read from incoming stream, but WCF reads only 255 bytes. Here is my upload function: public UploadResponse UploadFile(FileDto fileDto) { using (var inStream = fileDto.FileStream) using (var outStream = new FileStream("OutFile.txt", FileMode.Create)) { var buffer = new byte[4096]; int count; while ((count = inStream.Read(buffer, 0, buffer.Length)) > 0) {

Need some help with errors, culmination of a File System Project [closed]

我们两清 提交于 2019-12-14 03:28:02
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . class BufferFile{ public: BufferFile(IOBuffer &); int Open(char *); int Create(char *); int Close(); int Rewind(); int Read(int recaddr = -1); int Write(int recaddr = -1); int Append(); IOBuffer & GetBuffer();

Turn non-interleaved audio data into interleaved

假装没事ソ 提交于 2019-12-14 02:29:27
问题 I'm working with modified version of Apple's MixerHost Class which separates audio into two streams in its callbacks (this is to allow for the resulting audio to be either mono or stereo). The result, clearly, is a non-interleaved stream. I'm new to Core Audio, I need an interleaved stream, and I'm wondering if anyone can point me in the right direction to modify the buffers in a callback to store interleaved stereo data. Thank you. Here is one of the callbacks: static OSStatus

Read chunk from Gridfs and convert to Buffer

江枫思渺然 提交于 2019-12-14 02:20:24
问题 I got a question about buffer. Here is my code: var Grid = require('gridfs-stream'); var mongodb = require('mongodb'); var gfs = Grid(db, mongodb); var deferred = Q.defer(); var image_buf = new Buffer('buffer'); var readableStream = gfs.createReadStream(name); readableStream.on('data',function(chunk){ console.log(chunk); image_buf = Buffer.concat([image_buf, chunk]); console.log(image_buf)//differ from the chunk above }); readableStream.on('end',function(){ db.close(); deferred.resolve(image

SharedBuffer between Java and C++ using JNI

主宰稳场 提交于 2019-12-13 22:17:59
问题 what I am working on is to read image data from camera using C++ and use JNI to let Java read those image data, and I am using Mac OSX. The blocker I currently have is, I have not found any method to create a shared memory between two language on Mac OSX. I could imagine I will be using some buffer to do so, could anyone gives some hints and knowledge towards this problem? Thank you in advance! 回答1: You can use ByteBuffer.allocateDirect to create native accessible memory: public static native