buffer

Buffer overrun in 1 line ! (uses the PCRE library)

Well, if someone can help that would be nice...cause I'm almost going nuts ! I only have 1 line of code, and this is : pcrecpp::RE re("abc"); inside a function OnBnClickedButtonGo(). And this function fails in the Release Mode ..! ..while it works OK in debug mode. (I use VS 8 on WinXP) The error message is : "A buffer overrun has oc...

What is the optimal (speed) way of parsing a large (> 4GB) text file with many (milions) of lines?

I'm trying to determine what is the fastest way to read in large text files with many rows, do some processing, and write them to a new file. In C#/.net, it appears StreamReader is a seemingly quick way of doing this but when I try to use for this file (reading line by line), it goes about 1/3 the speed of python's I/O (which worries me...

Strategy flushing file outputs at termination

I have an application that monitors a high-speed communication link and writes logs to a file (via standard C file IO). The response time to messages that arrive on the link is important, so I knowingly don't fflush the file at each message, because this slows down my response time. However, in some circumstances my application is term...

Flash loading external file freezes page -or- multiple simultaneous downloads

I've got a flash mp3 player on one of my web pages, streaming external audio. Check this site out as an example (no affiliation, just an example): http://www.1pixelout.net/code/audio-player-wordpress-plugin/ When it's a decent sized mp3, once I start playing the file, it takes a little time to buffer. While it's buffering, if I click o...

When to use .NET BufferedStream class ?

The MSDN site states: A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. Buffers improve read and write performance. A buffer can be used for either reading or writing, but never both simultaneously. The Read and Write methods of BufferedStream auto...

How to marshal unmanaged buffer of packed structs in c#

Hello I am (successfully) calling the Windows FilterSendMessage function in c# using the following pinvoke signature: [DllImport("fltlib.dll")] public static extern IntPtr FilterSendMessage( IntPtr hPort, IntPtr inBuffer, UInt32 inBufferSize, IntPtr outBuffer, UInt32 outBufferSize, ou...

Common Causes of - Buffer Overflow Errors under .NET

I'm looking for common causes of Buffer Overflow errors under .NET. I know that buffer overflow is impossible under managed .NET code. However this exception is still possible in the scope of .NET application. Things I thought of - Valid arguments to COM object calls Valid arguments to PInvoke/Win32 calls What is the best method o...

Editor core buffer type and syntax highlighting

I've been thinking a lot about making an editor core functionality wise compatible to vim, similar to yzis. The biggest questions are what buffer type to use. Requirement are: possibility to implement fast syntax highlighting, regex on top of it. possibility to implement multiple syntax highlightings in a single file. similar to text...

How do you write to a buffer then to a file

I'm trying to write some STL data out of matlab and I'm trying to do this by writing a MEX File (a matlab DLL written in C) At the moment I have a loop just going through my data writing out the stl syntax with the floats. ... for(m=0;m<colLen;m++) { res = m % 3; if(res == 0) { fprintf(fp, "\tfacet normal %f %f ...

One big byte buffer or several small ones?

I'm learning C# asynchronous socket programming, and I've learned that it's a good idea to reuse byte buffers in some sort of pool, and then just check one out as needed when receiving data from a socket. However, I have seen two different methods of doing a byte array pool: one used a simple queue system, and just added/removed them f...

ido-switch-buffer and bury-buffer

I've recently started using ido-mode, which, overall, is pretty nice. But one thing seems especially broken, and I'm wondering if there's a setting (ha) buried in there to fix it. ido-switch-buffer doesn't seem to care about buried buffers. That is, if I use bury-buffer, and then ido-switch-buffer, the first choice is often the one I ...

Another shell open when at server?

How can I have another Terminal open when I am at my server by ssh? I do not want to type my password twice to get another terminal for my server. Perhaps, Bash has buffers similarly as Vim. ...

What does it mean by buffer?

I see word BUFFER everywhere but I am unable to grasp what it exactly is. Would anybody please explain what is buffer in layman's language? When is it used? How is it used? Thanks. ...

Should a buffer of bytes be signed or unsigned char buffer?

Should a buffer of bytes be signed char or unsigned char or simply a char buffer? Any differences between C and C++? Thanks. ...

the buffer and output sequence of cout and printf

I know cout and printf have buffer today, and it is said that the buffer is some like a stack and get the output of cout and printf from right to left, then put them out(to the console or file)from top to bottem. Like this, a = 1; b = 2; c = 3; cout<<a<<b<<c<<endl; buffer:|3|2|1|<- (take “<-” as a poniter) output:|3|2|<- (output ...

Byte array of unknown length in java

I am constructing an array of bytes in java and I don't know how long the array will be. I want some tool like Java's StringBuffer that you can just call .append(byte b) or .append(byte[] buf) and have it buffer all my bytes and return to me a byte array when I'm done. Is there a class that does for bytes what StringBuffer does for S...

How the buffer of cout work?

I know that cout have buffer several days ago, and when I google it, it is said that the buffer is some like a stack and get the output of cout and printf from right to left, then put them out(to the console or file)from top to bottem. Like this, a = 1; b = 2; c = 3; cout<<a<<b<<c<<endl; buffer:|3|2|1|<- (take “<-” as a poniter) outp...

What is the difference among heap spraying, heap overflow, heap overrun?

What is the difference among heap spraying, heap overflow, heap overrun? Can those terms be replaced with buffer spraying, buffer overflow, buffer overrun? Do they have the same definitions as well? ...

In case of integer overflows what is the result of (unsigned int) * (int) ? unsigned or int?

In case of integer overflows what is the result of (unsigned int) * (int) ? unsigned or int? I was auditing the following function, and suddenly I came out with that question. In the below function, it is vulnerable at line 17. 1. // Create a character array and initialize it with init[] 2. // repeatedly. The size of this character ...

GDI+ Offscreen Buffered Scrolling

Hello, I am creating a custom control using C# GDI+. Quick explanation...the control will be say 500 pixels on screen but will contain perhaps 500000 pixels of information. So although i'm only showing 500px at a time i need to obviously scroll in the horizontal plane (left & right). The tricky part is that each 500px chunk of bitmap t...