¡@

Home 

c++ Programming Glossary: handle

C++ convert hex string to signed integer

http://stackoverflow.com/questions/1070497/c-convert-hex-string-to-signed-integer

solution which manually sets the input stream to hex will handle it just fine. Boost has some stuff to do this as well which..

How do malloc() and free() work?

http://stackoverflow.com/questions/1119134/how-do-malloc-and-free-work

The other reason of course is that the OS can only handle memory chunks that are of a specific size and alignment. To.. and alignment. To be specific Normally the OS can only handle blocks that the virtual memory manager can handle most often.. can only handle blocks that the virtual memory manager can handle most often multiples of 512 Bytes eg. 4KB . So returning 40..

throwing exceptions out of a destructor

http://stackoverflow.com/questions/130117/throwing-exceptions-out-of-a-destructor

from a destructor results in undefined behavior how do you handle errors that occur during a destructor If an error occurs during.. just ignore it If it is an error that can potentially be handled up the stack but not right in the destructor doesn't it make.. directly . The user of your class can then potentially handle these situations by using the public methods and catching any..

Best open XML parser for C++ [closed]

http://stackoverflow.com/questions/170686/best-open-xml-parser-for-c

In comparison to C Tree the C Parser mapping allows one to handle large XML documents that would not fit in memory perform stream..

What is the difference between new/delete and malloc/free?

http://stackoverflow.com/questions/240212/what-is-the-difference-between-new-delete-and-malloc-free

compiler calculates the size Has a version explicitly to handle arrays. Reallocating to get more space not handled intuitively.. to handle arrays. Reallocating to get more space not handled intuitively because of copy constructor . Whether they call.. add a new memory allocator to deal with low memory set_new_handler operator new delete can be overridden legally constructor destructor..

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

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

read the whole file into the buffer t.close close file handle ... Do stuff with buffer here ... Now I want to do the exact..

How to implement big int in C++

http://stackoverflow.com/questions/269268/how-to-implement-big-int-in-c

int class in C as a programming exercise. A class that can handle numbers bigger then a long int. I know that there are several.. big int class should be convertible to and how to properly handle the conversion. A quick list would include double and float..

Advantages of using forward

http://stackoverflow.com/questions/3582001/advantages-of-using-forward

B typename C void f A a B b C c E a b c But this fails to handle temporary values f 1 2 3 as those cannot be bound to an lvalue.. f i j k ouch E can modify a const object A final solution handles everything correctly...at the cost of being impossible to maintain...

std::wstring VS std::string

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

comment from Johann Gerell a std string will be enough to handle all char based strings each char being a number from 0 to 255..

Stack,Static and Heap in C++

http://stackoverflow.com/questions/408670/stack-static-and-heap-in-c

programming in C and C are pointers and how to correctly handle their dynamic memory allocations. Some other languages like..

C/C++: Capture characters from standard input without waiting for enter to be pressed

http://stackoverflow.com/questions/421860/c-c-capture-characters-from-standard-input-without-waiting-for-enter-to-be-pr

opposed to cooked mode look into man stty . Curses would handle that for you in a portable manner if i'm not mistaken. share..

How to generate a stacktrace when my gcc C++ app crashes

http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes

stack trace to me so I can track down the problem. I can handle the sending the info to me but I don't know how to generate.. manual . Here's an example program that installs a SIGSEGV handler and prints a stacktrace to stderr when it segfaults. The baz.. baz function here causes the segfault that triggers the handler #include stdio.h #include execinfo.h #include signal.h #include..

Why can't variables be declared in a switch statement?

http://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement

the code skipping the initialization. The correct way to handle this is to define a scope specific to that case statement and..

Read a password from std::cin

http://stackoverflow.com/questions/1413445/read-a-password-from-stdcin

look like void SetStdinEcho bool enable true #ifdef WIN32 HANDLE hStdin GetStdHandle STD_INPUT_HANDLE DWORD mode GetConsoleMode.. true #ifdef WIN32 HANDLE hStdin GetStdHandle STD_INPUT_HANDLE DWORD mode GetConsoleMode hStdin mode if enable mode ~ENABLE_ECHO_INPUT..

How might I wrap the FindXFile-style APIs to the STL-style Iterator Pattern in C++?

http://stackoverflow.com/questions/2531874/how-might-i-wrap-the-findxfile-style-apis-to-the-stl-style-iterator-pattern-in-c

For unit testing struct RealFindXFileFunctions static HANDLE FindFirst LPCWSTR lpFileName LPWIN32_FIND_DATAW lpFindFileData.. lpFileName lpFindFileData static BOOL FindNext HANDLE hFindFile LPWIN32_FIND_DATAW lpFindFileData return FindNextFile.. FindNextFile hFindFile lpFindFileData static BOOL Close HANDLE hFindFile return FindClose hFindFile inline std wstring const_iterator..

Prevent user process from being killed with “End Process” from Process Explorer

http://stackoverflow.com/questions/6185975/prevent-user-process-from-being-killed-with-end-process-from-process-explorer

supply the answer in code static const bool ProtectProcess HANDLE hProcess GetCurrentProcess EXPLICIT_ACCESS denyAccess 0 DWORD..

How to determine CPU and memory consumption from inside a process?

http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process

lastSysCPU lastUserCPU static int numProcessors static HANDLE self void init SYSTEM_INFO sysInfo FILETIME ftime fsys fuser..

How can I get a process handle by its name in C++?

http://stackoverflow.com/questions/865152/how-can-i-get-a-process-handle-by-its-name-in-c

PROCESSENTRY32 entry entry.dwSize sizeof PROCESSENTRY32 HANDLE snapshot CreateToolhelp32Snapshot TH32CS_SNAPPROCESS NULL if.. entry TRUE if stricmp entry.szExeFile target.exe 0 HANDLE hProcess OpenProcess PROCESS_ALL_ACCESS FALSE entry.th32ProcessID.. windows.h #include tlhelp32.h void EnableDebugPriv HANDLE hToken LUID luid TOKEN_PRIVILEGES tkp OpenProcessToken GetCurrentProcess..

Floating point comparison revisited

http://stackoverflow.com/questions/13940316/floating-point-comparison-revisited

bool almostEqual const T a const T b const unsigned ulps 4 Handle NaN. if std isnan a std isnan b return false typedef std numeric_limits.. isnan b return false typedef std numeric_limits T limits Handle very small and exactly equal values. if std abs a b ulps limits..

Is there a proper 'ownership-in-a-package' for 'handles' available?

http://stackoverflow.com/questions/14878121/is-there-a-proper-ownership-in-a-package-for-handles-available

a proper 'ownership in a package' for 'handles' available Handles have proper semantics other than pointers. So for me an example.. to the basic type the opaque handle type builds upon. Handles can be any type they may be a pointer they may be an index.. class won't take long. Don't abuse library classes. Handle semantics is quite different from that of a C pointer for one..

Why V8 in Node.JS is faster than in my native C++ addon?

http://stackoverflow.com/questions/15393039/why-v8-in-node-js-is-faster-than-in-my-native-c-addon

primeGeneratorBenchmark native.cpp #include node.h v8 Handle v8 Value primeGeneratorBenchmark const v8 Arguments arguments.. const v8 Arguments arguments void registerModule v8 Handle v8 Object target v8 Handle v8 Value primeGeneratorBenchmark.. void registerModule v8 Handle v8 Object target v8 Handle v8 Value primeGeneratorBenchmark const v8 Arguments arguments..

How can I measure CPU time and wall clock time on both Linux/Windows?

http://stackoverflow.com/questions/17432502/how-can-i-measure-cpu-time-and-wall-clock-time-on-both-linux-windows

LARGE_INTEGER time freq if QueryPerformanceFrequency freq Handle error return 0 if QueryPerformanceCounter time Handle error.. Handle error return 0 if QueryPerformanceCounter time Handle error return 0 return double time.QuadPart freq.QuadPart double.. unsigned long long d.dwHighDateTime 32 0.0000001 else Handle error return 0 Posix Linux #else #include sys time.h double..

How to handle a ctrl-break signal in a command line interface

http://stackoverflow.com/questions/181413/how-to-handle-a-ctrl-break-signal-in-a-command-line-interface

handler #include signal.h void signal_handler int sig Handle the signal int main void Register the signal handler for the..

How Visitor Pattern avoid downcasting

http://stackoverflow.com/questions/3254788/how-visitor-pattern-avoid-downcasting

Base Some arbitrary function that handles Base. void Handle Base obj if ...type is Derived1... Derived1 d1 static_cast Derived1.. Derived2 n Some arbitrary function that handles Base. void Handle Base obj Printer p obj.Accept p Accept is a virtual function..

What techniques can be used to speed up C++ compilation times?

http://stackoverflow.com/questions/373142/what-techniques-can-be-used-to-speed-up-c-compilation-times

idiom here and here . Also known as an Opaque Pointer or Handle. Not only does it speed up compilation it also increases exception..

How to get Process Name in C++

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

Dependencies int _tmain int argc _TCHAR argv HANDLE Handle OpenProcess PROCESS_QUERY_INFORMATION PROCESS_VM_READ FALSE.. is the PID you can find one from windows task manager if Handle TCHAR Buffer MAX_PATH if GetModuleFileNameEx Handle 0 Buffer.. if Handle TCHAR Buffer MAX_PATH if GetModuleFileNameEx Handle 0 Buffer MAX_PATH At this point buffer contains the full path..

Portability of Native C++ properties

http://stackoverflow.com/questions/5772480/portability-of-native-c-properties

_type _name class Window public _property_readonly void Handle GetHandle _property bool Visible GetVisible SetVisible void.. class Window public _property_readonly void Handle GetHandle _property bool Visible GetVisible SetVisible void GetHandle.. _property bool Visible GetVisible SetVisible void GetHandle bool GetVisible void SetVisible bool void main Window MainWindow..

Why should the “PIMPL” idiom be used?

http://stackoverflow.com/questions/60570/why-should-the-pimpl-idiom-be-used

Cat private class CatImpl Not defined here CatImpl cat_ Handle public Cat Constructor ~Cat Destructor Other operations.....