buffer

how can I write an ANSI C console screen buffer?

I'm working on making an ASCII based game, and everywhere I look people are saying to use Console.Write() from MSDN, which is dandy and all if you're using Windows, but I'm not. And thus, I'm trying to write a function, or group of functions in C that can alternate between two screen buffers, and write them to the screen, similar to wha...

How to insert repeated message in google protocol buffer _pb2.py file

How to insert repeated message in google protocol buffer _pb2.py file ...

memorystream - stringstream, string, others?

hello, i am reading in a binary file via the usual c++/STL/iostream syntax. i am copying the whole content into an dynamically allocated char array and this works fine so far. but since i want to serve parts of the content as lines to another part of the program, i think it would be better/easier to stick to streams because i don't wan...

Java: Generalization possible between: streams, readers, char buffers, stringbuilder, ...?

Hello everyone! Background story: There are these Source and Result interfaces for XML. These are adapters between different XML technologies in Java. Instances of these classes represent DOM, SAX, JAXB, XML streams, XML events (and even more?). The question: So, is there something comparable for plain old strings? Some generalizatio...

Python: Extracting data from buffer with ctypes

I am able to successfully call a function with ctypes in Python. I now have a buffer that is filled with Structures of data I want to extract. What is the best strategy for this? Anything else I should post? Function: class list(): def __init__(self): #[...] def getdirentries(self, path): self.load_c() ...

Circular buffer in JavaScript

I was wondering whether anyone has already implemented a circular buffer in JavaScript? How would you do that without having pointers? ...

Call assembly in buffer in C

Is this possible? I want to place intel assembly code into a char buffer, and then execute that code from within a C program If I placed the assembly code into a buffer, could I cast it into a function pointer and call that? I am using GCC and linux ...

Uploading file with WCF streaming, tiny reads from stream

Hi 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) ...

How to design an efficient image buffer in C++?

I am trying to create a data buffer, more specifically, an image buffer, which will be shared among multiple modules. Those modules only reads from the buffer and don't communicate with each other at all. My difficulty is: 1.Large data size: larger than 10M per image, that means copying those data around for different threads is not...

How to play MP3 sound from buffer (ByteArray/Stream) in ActionScript 3?

So.. I have a buffer with MP3 data (If I would save this buffer and call it buffer.mp3 it would play, but in this situation I should not save it to file system). I have to play it, but I can not, what shall I do? I tried the next code to play that buffrer(ByteArray\Stream) (I get MP3 data from server the method of getting data works ...

Separating Code To Be Organized

I'm building a zipper application, but it has a declaration that I want to separate it in another file (compress-file.m), but only when I separate the files I got an error when compiling with a variable, see it: [ubuntu@eeepc:~/Desktop] make This is gnustep-make 2.0.2. Type 'make print-gnustep-make-help' for help. Making all for app Lea...

Is it practical to include an adaptive or optimizing memory strategy into a library?

I have a library that does I/O. There are a couple of external knobs for tuning the sizes of the memory buffers used internally. When I ran some tests I found that the sizes of the buffers can affect performance significantly. But the optimum size seems to depend on a bunch of things - the available memory on the PC, the the size of t...

Circular Buffer in Flash

I need to store items of varying length in a circular queue in a flash chip. Each item will have its encapsulation so I can figure out how big it is and where the next item begins. When there are enough items in the buffer, it will wrap to the beginning. What is a good way to store a circular queue in a flash chip? There is a possibi...

Manipulate screen buffer in python

I know this is a long shot, but I was wondering if Python had a way to manipulate the screen buffer. Specifically, I want to be able to gray-out my desktop and highlight my windows when I press a key combination. Is this in the realm of possibility? ...

Manage data inside a buffer

I'm using this code to read a file into a buffer. The file is full of structs of evaluacion type (including some char and int variables). Now I have the whole file in a buffer, how can I find the values of one variable in the buffer now? For example buf.notamedia < 4. There are supposed to be many of them inside the file. #include <unis...

Implementing a fixed-size log file, or a circular buffer on disk

I checked this question, but it's not what I'm looking for. I'm trying to figure out how to cap a log file's size (say, 10MB), and as soon as it's hit, either: start writing to the beginning, rather than appending, or keep appending, but delete the contents from the beginning as I do so Don't really care about language - as long as...

Reading socket buffer using asyncore

I'm new to Python (I have been programming in Java for multiple years now though), and I am working on a simple socket-based networking application (just for fun). The idea is that my code connects to a remote TCP end-point and then listens for any data being pushed from the server to the client, and perform some parsing on this. The da...

Why is that data structures usually have a size of 2^n ?

Is there a historical reason or something ? I've seen quite a few times something like char foo[256]; or #define BUF_SIZE 1024. Even I do mostly only use 2^n sized buffers, mostly because I think it looks more elegant and that way I don't have to think of a specific number. But I'm not quite sure if that's the reason most people use them...

writing to GUI issue

hello, So i have a setup where two imacs, imac_1 and imac_2, are connected through firewire. imac_1 sends some debugging information to imac_2 and on imac_2 i have a program in c++ that captures debugging information.(see illustration below) Now the problem is that if i write the debugging info to the GUI (created using QT) directly i...

How do I modify the internal buffer of std::cin

Hello, I am writing a software that grabs a password using std::cin However unlikely, i am trying to avoid the possibility that the password get paged to the disk from memory so I want to modify the buffer of std::cin to overwrite the password as soon as I'm done with it. right now i have this: std::cin.clear(); std::stringstream ss;...