¡@

Home 

c++ Programming Glossary: buffer

What do the following phrases mean in C++: zero-, default- and value-initialization?

http://stackoverflow.com/questions/1613341/what-do-the-following-phrases-mean-in-c-zero-default-and-value-initializat

buf 0x5a sizeof buf use placement new on the memset'ed buffer to make sure if we see a zero result it's due to an explicit..

In what cases do I use malloc vs new?

http://stackoverflow.com/questions/184537/in-what-cases-do-i-use-malloc-vs-new

malloc would be if you needed to change the size of your buffer of data. The new keyword does not have an analogous way like..

How do you reverse a string in place in C or C++?

http://stackoverflow.com/questions/198199/how-do-you-reverse-a-string-in-place-in-c-or-c

reverse a string in C or C without requiring a separate buffer to hold the reversed string c c string reverse share improve..

C++: “std::endl” vs “\n”

http://stackoverflow.com/questions/213907/c-stdendl-vs-n

The only difference is that std endl flushes the output buffer and ' n' doesn't. If you don't want the buffer flushed frequently.. the output buffer and ' n' doesn't. If you don't want the buffer flushed frequently use ' n' . If you do for example if you want..

What uses are there for “placement new”?

http://stackoverflow.com/questions/222557/what-uses-are-there-for-placement-new

new operator which constructs an object on a pre allocated buffer. This is useful when building a memory pool a garbage collector.. allocated and constructing an object on a pre allocated buffer takes less time char buf new char sizeof string pre allocated.. less time char buf new char sizeof string pre allocated buffer string p new buf string hi placement new string q new string..

Read whole ASCII file into C++ std::string

http://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring

the length t.seekg 0 std ios beg go back to the beginning buffer new char length allocate memory for a buffer of appropriate.. the beginning buffer new char length allocate memory for a buffer of appropriate dimension t.read buffer length read the whole.. memory for a buffer of appropriate dimension t.read buffer length read the whole file into the buffer t.close close file..

Using fflush(stdin)

http://stackoverflow.com/questions/2979209/using-fflushstdin

google search for fflush stdin for clearing the input buffer reveals numerous websites warning against using it. And yet..

std::wstring VS std::string

http://stackoverflow.com/questions/402283/stdwstring-vs-stdstring

Notice A std string is suitable for holding a 'binary' buffer where a std wstring is not On Linux Yes. On Windows Only special..

What are the barriers to understanding pointers and what can be done to overcome them?

http://stackoverflow.com/questions/5727/what-are-the-barriers-to-understanding-pointers-and-what-can-be-done-to-overcome

in nature. However in order to accurately explain how buffer overruns really work it was important that I added these diagrams...

Can placement new for arrays be used in a portable way?

http://stackoverflow.com/questions/15254/can-placement-new-for-arrays-be-used-in-a-portable-way

~A int data int main const int NUMELEMENTS 20 char pBuffer new char NUMELEMENTS sizeof A A pA new pBuffer A NUMELEMENTS.. 20 char pBuffer new char NUMELEMENTS sizeof A A pA new pBuffer A NUMELEMENTS With VC pA will be four bytes higher than pBuffer.. A NUMELEMENTS With VC pA will be four bytes higher than pBuffer printf Buffer address x Array address x n pBuffer pA Debug runtime..

What are all the common undefined behaviour that a C++ programmer should know about? [closed]

http://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-a-c-programmer-should-know-ab

types Using memcpy to copy overlapping buffers . Buffer overflows Reading or writing to an object or array at an offset..

When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete?

http://stackoverflow.com/questions/370195/when-and-why-will-an-os-initialise-memory-to-0xcd-0xdd-etc-on-malloc-free-new

past the end or start of an allocated block. 0xFD or Buffer slack Used to fill slack space in some memory buffers 0xFE ..

placement new + array +alignment

http://stackoverflow.com/questions/4011577/placement-new-array-alignment

new array alignment SomeObj unsigned int Buffer char BufferPtr MemoryManager giveMeSomeBytes resX resY sizeof.. new array alignment SomeObj unsigned int Buffer char BufferPtr MemoryManager giveMeSomeBytes resX resY sizeof SomeObj unsigned.. giveMeSomeBytes resX resY sizeof SomeObj unsigned int Buffer new BufferPtr SomeObj unsigned int resX resY when I step past..

How to get Process Name in C++

http://stackoverflow.com/questions/4570174/how-to-get-process-name-in-c

can find one from windows task manager if Handle TCHAR Buffer MAX_PATH if GetModuleFileNameEx Handle 0 Buffer MAX_PATH At.. TCHAR Buffer MAX_PATH if GetModuleFileNameEx Handle 0 Buffer MAX_PATH At this point buffer contains the full path to the..

How to get IOStream to perform better?

http://stackoverflow.com/questions/5166263/how-to-get-iostream-to-perform-better

this question Here is what I have gathered so far Buffering If by default the buffer is very small increasing the buffer.. number of HDD hits it reduces the number of system calls Buffer can be set by accessing the underlying streambuf implementation... by accessing the underlying streambuf implementation. char Buffer N std ifstream file file.txt file.rdbuf pubsetbuf Buffer N the..

Storing multiple messages in one protocol buffer binary file

http://stackoverflow.com/questions/5586323/storing-multiple-messages-in-one-protocol-buffer-binary-file

question Here's what Techniques section of the Protocol Buffers documentation says about repeated messages If you want to write.. where one message ends and the next begins. The Protocol Buffer wire format is not self delimiting so protocol buffer parsers.. for details Are there C equivalents for the Protocol Buffers delimited I O functions in Java share improve this answer..

What are the barriers to understanding pointers and what can be done to overcome them?

http://stackoverflow.com/questions/5727/what-are-the-barriers-to-understanding-pointers-and-what-can-be-done-to-overcome

of the dangling pointer above. See its memory layout. Buffer overrun You move more stuff into the house than you can possibly..

C/C++ Free alternative to Lint? [closed]

http://stackoverflow.com/questions/632057/c-c-free-alternative-to-lint

erase After pushback or pushfront iterator may be invalid Buffer overruns Dangerous usage of strncat possible buffer overrun..

placement new and delete

http://stackoverflow.com/questions/6783993/placement-new-and-delete

char charString Hello World void mem operator new sizeof Buffer strlen charString 1 Buffer buf new mem Buffer strlen charString.. void mem operator new sizeof Buffer strlen charString 1 Buffer buf new mem Buffer strlen charString delete char buf OR const.. new sizeof Buffer strlen charString 1 Buffer buf new mem Buffer strlen charString delete char buf OR const char charString Hello..

Why is strncpy insecure?

http://stackoverflow.com/questions/869883/why-is-strncpy-insecure

displaying the exploits of strncpy as well as strcpy Buffer overflow using a custom version of the strcpy function char..