C++ Library –

C++ Library – <thread> ”; Previous Next Introduction Thread is a sequence of instructions that can be executed concurrently with other such sequences in multithreading environments, while sharing a same address spac. Member types Sr.No. Member type & description 1 id It is a thread id. 2 Native handle type It is a native handle type. Member functions Sr.No. Member function & description 1 (constructor) It is used to construct thread. 2 (destructor) It is used to destructor thread. 3 operator= It is a move-assign thread. 4 get_id It is used to get thread id. 5 joinable It is used to check if joinable. 6 join It is used to join thread. 7 detach It is used to detach thread. 8 swap It is used to swap threads. 9 native_handle It is used to get native handle. 10 hardware_concurrency [static] It is used to detect hardware concurrency. Non-member overloads Sr.No. Non-member overload & description 1 swap (thread) It is used to swap threads. Example In below example for std::thread. #include <iostream> #include <thread> void foo() { std::cout << ” foo is executing concurrently…n”; } void bar(int x) { std::cout << ” bar is executing concurrently…n”; } int main() { std::thread first (foo); std::thread second (bar,0); std::cout << “main, foo and bar now execute concurrently…n”; first.join(); second.join(); std::cout << “foo and bar completed.n”; return 0; } The output should be like this − main, foo and bar now execute concurrently… bar is executing concurrently… foo is executing concurrently… foo and bar completed. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <streambuf> ”; Previous Next Introduction It is a stream buffer and it is to be used in combination with input/output streams. Class templates Sr.No. Class & Definition 1 basic_streambuf It is a basic stream buffer 2 wstreambuf It is used in base buffer class in stream Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <atomic> ”; Previous Next Introduction These are types that encapsulate a value whose access is guaranteed to not cause data races and can be used to synchronize memory accesses among different threads and he atomic library provides components for fine-grained atomic operations allowing for lockless concurrent programming. Each atomic operation is indivisible with regards to any other atomic operation that involves the same object. Atomic type Sr.No. Member types & Definition 1 atomic Atomic class template and specializations for bool, integral, and pointer types C-style atomic types The following are atomic types and also defined in this header. contained type atomic type description bool atomic_bool char atomic_char atomics for fundamental integral types. These are either typedefs of the corresponding full specialization of the atomic class template or a base class of such specialization. signed char atomic_schar unsigned char atomic_uchar short atomic_short unsigned short atomic_ushort int atomic_int unsigned int atomic_uint long atomic_long unsigned long atomic_ulong long long atomic_llong unsigned long long atomic_ullong wchar_t atomic_wchar_t char16_t atomic_char16_t char32_t atomic_char32_t intmax_t atomic_intmax_t atomics for width-based integrals (those defined in <cinttypes>). Each of these is either an alias of one of the above atomics for fundamental integral types or of a full specialization of the atomic class template with an extended integral type. Where N is one in 8, 16, 32, 64, or any other type width supported by the library. uintmax_t atomic_uintmax_t int_leastN_t atomic_int_leastN_t uint_leastN_t atomic_uint_leastN_t int_fastN_t atomic_int_fastN_t uint_fastN_t atomic_uint_fastN_t intptr_t atomic_intptr_t uintptr_t atomic_uintptr_t size_t atomic_size_t ptrdiff_t atomic_ptrdiff_t Operations on atomic types Sr.No. Operations & Definition & 1 atomic_is_lock_free It is used to checks if the atomic type”s operations are lock-free 2 atomic_store & atomic_store_explicit It automically replaces the value of the atomic object with a non-atomic argument 3 atomic_load & atomic_load_explicit It atomically obtains the value stored in an atomic object 4 atomic_exchange & atomic_exchange_explicit It atomically replaces the value of the atomic object with non-atomic argument and returns the old value of the atomic 5 atomic_compare_exchange_weak & atomic_compare_exchange_weak_explicit & atomic_compare_exchange_strong & atomic_compare_exchange_strong_explicit It atomically compares the value of the atomic object with non-atomic argument and performs atomic exchange if equal or atomic load if not 6 atomic_fetch_add & atomic_fetch_add_explicit It adds a non-atomic value to an atomic object and obtains the previous value of the atomic 7 atomic_fetch_sub & atomic_fetch_sub_explicit It subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic 8 atomic_fetch_and & atomic_fetch_and_explicit It replaces the atomic object with the result of logical AND with a non-atomic argument and obtains the previous value of the atomic 9 atomic_fetch_or & atomic_fetch_or_explicit It replaces the atomic object with the result of logical OR with a non-atomic argument and obtains the previous value of the atomic 10 atomic_fetch_xor & atomic_fetch_xor_explicit It replaces the atomic object with the result of logical XOR with a non-atomic argument and obtains the previous value of the atomic Flag type and operations Sr.No. Flag type & Definition 1 atomic_flag The lock-free boolean atomic type 2 atomic_flag_test_and_set & atomic_flag_test_and_set_explicit It atomically sets the flag to true and returns its previous value 3 atomic_flag_clear & atomic_flag_clear_explicit It atomically sets the value of the flag to false Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <ostream> ”; Previous Next Introduction It is an output stream objects can write sequences of characters and represent other kinds of data. Specific members are provided to perform these output operations. Definition Below is definition of std::ostream. typedef basic_ostream<char> ostream; Parameters charT − Character type. traits − Character traits class that defines essential properties of the characters used by stream objects. Member types Sr.No. Member types Definition 1 event Type to indicate event type 2 event_callback Event callback function type 3 failure Base class for stream exceptions 4 fmtflags Type for stream format flags 5 Init Initialize standard stream objects 6 iostate Type for stream state flags 7 openmode Type for stream opening mode flags 8 seekdir Type for stream seeking direction flag 9 basic_istream::sentry It is used to prepare stream for input 10 seekdirbasic_ostream::sentry It is used to prepare stream for output Public Member Functions Sr.No. Member types Definition 1 (constructor) Construct object (public member function ) 2 (destructor) Destruct object (public member function ) Public member functions Sr.No. Member Functions Definition 1 gcount It is used to get character count 2 get It is used to get characters 3 getline It is used to get line 4 ignore It is used to extract and discard characters 5 peek It is used to peek next character 6 read It is used to read block of data 7 readsome It is used to Read data available in buffer 8 putback It is used to put character back 9 unget It is used to unget character Formatted output Sr.No. Output Definition 1 operator>> It is used to extract formatted input Unformatted output Sr.No. Output Definition 1 put It is used to put character 2 write It is used to write block of data Positioning Sr.No. Position Definition 1 tellp It is used to get position in output sequence 2 seekp It is used to set position in output sequence Synchronization Sr.No. Synchronization Definition 1 flush It is used to flush output stream buffer Protected member functions Sr.No. Member Functions Definition 1 operator= It is used to move assignment 2 swap It is used to swap internals Public member functions inherited from basic_ios Sr.No. Member types Definition 1 good It is used to check whether state of stream is good 2 eof It is used to check whether eofbit is set 3 fail It is used to check whether either failbit or badbit is set 4 bad It is used to check whether badbit is set 5 operator! Evaluate stream 6 rdstate It is used to get error state flags 7 setstate It is used to set error state flag 8 clear It is used to set error state flag 9 fill Get/set fill character 10 exceptions It is used to get/set exceptions mask 11 imbue Imbue locale 12 tie It is used to get/set tied stream 13 rdbuf It is used to get/set stream buffer 14 narrow Narrow character 15 widen Widen character Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <istream> ”; Previous Next Description The Istream used for header providing the standard input and combined input/output stream classes. Class templates The class templates of istream should be as follows − Sr.No. Stream Definition 1 basic_istream It is used in an Input stream 2 basic_iostream It is used in an Input/output stream Classes The classes of istram should be as follows. Sr.No. Classes Definition 1 istream It is used in an Input stream 2 iostream It is used in an Input/output stream 3 wistream It is used in an Input stream (wide) 4 wiostream It is used in an Input/output stream (wide) Input manipulators (functions) Sr.No. Functions Definition 1 ws It is used to extract whitespaces Print Page Previous Next Advertisements ”;

C Library – Home

C Standard Library Reference Tutorial PDF Version Quick Guide Resources Job Search Discussion C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the Unix operating system. C is the most widely used computer language, that keeps fluctuating at number one scale of popularity along with Java programming language which is also equally popular and most widely used among modern software programmers. The C Standard Library is a set of C built-in functions, constants and header files like <stdio.h>, <stdlib.h>, <math.h>, etc. This library will work as a reference manual for C programmers. Audience The C Standard Library is a reference for C programmers to help them in their projects related to system programming. All the C functions have been explained in a user-friendly way and they can be copied and pasted in your C projects. Prerequisites A basic understanding of the C Programming language will help you in understanding the C built-in functions covered in this library. Print Page Previous Next Advertisements ”;