» Home » buffer » Page 1
boost::asio::buffer: Getting the buffer size and preventing buffer overflow?
Category : Programming Languages

I have the two following functions for sending and receiving packets.


void send(std::string protocol)
{
char *request=new char[protocol.size()+1];
request[protocol.size()] = 0;
memcpy(request,protocol.c_str(),protocol.size());
request_length = std::strlen(request);
boost::asio::write

View Replies


segfault while sending buffer pointer as pass-by-value to a function, inside which reallocate happens on that buffer
Category : Programming Languages

If I have the following code, where I allocate my memory in the main function and then pass it to a function, which fills it for me like this:


main()
{
char *bar = (char*) malloc(sizeof(char));
while(1)
{
foo(bar);
free(bar);
bar = (char*) malloc(sizeof(char));
}
}
foo(char *bar)
{

View Replies


Recenter a named buffer that is not neccessarily the current buffer in Emacs Lisp
Category : Web Design

I'd like to recenter a buffer, called *Lense*, where I've inserted some text. I wished to make it the current buffer by (set-buffer "*Lense*"), then (recenter 0)). By the following code segments:


(save-excursion (set-buffer "*Lense*")
(recenter 0))

However, it seems that the above code would only re


View Replies


How to copy a region or a whole buffer to another buffer in Emacs without affecting the kill ring?
Category : Web Design

I'd like to copy the region to another (temporary) buffer in Emacs, but if there's no (acive) region, I'd like to copy the whole current buffer. What I did is as follows:


(defun do-something-with-region-or-buffer ()
(interactive)
(save-excursion
(let ((begin (point-min)) (end (point-max)))
(when (region-active-p)
(setq begin (region

View Replies


Is there an emacs defun that converts XML in a buffer to JSON? jsonify-buffer? JSONize?
Category : Programming Languages

Ever seen Htmlize? Invoked in an existing buffer, it produces a new buffer with the HTML-ized version of the original buffer contents.


I'd like something similar, but I want it for XML-to-JSON. (and Vice versa for bonus points).


Given an XML buffer, I'd like to produce an "equivalent" JSON buffer, constructed based on a few settings or assuumptions.


For


View Replies


Parsing Buffer C - Advance buffer past whitespace, store word
Category : Programming Languages

It's been awhile since I worked with the standard C library's string parsing code (sprintf, atoi, etc).


My specific, current need is as follows:


advance_buf( const char*& buf, const char* removed_chars, int size );

It should advance the buf pointer to beyond the group of whitespace and copy the removed characters into remove


View Replies


c++ boost would async_read_some be blocked by buffer if the buffer is being fill by a data stream?
Category : Programming Languages

For example, if a server is sending a packet of bit stream to my tcp client, and I am beginning to use async_read_some to retrieve it.


Is this async_read_some operation might retrieve only part of the packet from the buffer, or is the buffer mutable so the async_read_some would be blocked until this packet stream is fully arrived?


View Replies


Dalvik message - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required
Category : Programming Languages

When I used BufferedInputStream and I specify a buffer size, Dalvik gives me this warning - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.


But right now, my buffer size is already at 8k. What am I doing wrong?


View Replies


Emacs: search a buffer with regex and show results in a new buffer?
Category : Programming Languages

Supposed I had a buffer in emacs with 1000 lines, and dotted around in that buffer were unicode references (eg. u8226). I want to collect all those references into another buffer, which I can then sort and uniquify.


On the (*nix) command line, I can do something like:


grep -o "u[0-9]*" tmpfile | sort | uniq

Is this achievable directly


View Replies


how do I close the indirect buffer and return to the main buffer in org-mode?
Category : Development Tools & Services

In org-mode, I can run org-tree-to-indirect-buffer to open a subtree in an indirect buffer and edit it in isolation.


When I'm done editing the subtree in the indirect buffer, what command do I run to close the buffer containing the subtree and return to the main buffer containing all my trees?


View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .