C : Scope of cstdio library and stdio.h header file

Objectives: Streaming with C and C++

  • C Programming: The library (cstring) holding header files(like stdio.h), which allow Input and output operation. C programming follows top-down steps, 
    • example
      #include <stdio.h>
      #include <string.h>
  • C++ Programming : Being a true object oriented programming language, input and output operation are carried with classes listed below.
    • example
      #include <iostream>
      #include <fstream>

    • The sequence of characters of C string manipulation is static and unsafe, comparing with C++. The string class in C++ is a part of standard library and embedded in namespace "std".
 
String Input and Output operation with C and C++ library

 C++

 String constructors create strings from arrays of characters and other strings
 String operators concatenate strings, assign strings, use strings for I/O, compare strings
append append characters and strings onto a string
 assign give a string values from strings of characters and other C++ strings
 at returns an element at a specific location
 begin returns an iterator to the beginning of the string
c_str returns a standard C character array version of the string
 capacity returns the number of elements that the string can hold
 clear removes all elements from the string
compare compares two strings
copy copies characters from a string into an array
 data returns a pointer to the first character of a string
 empty true if the string has no elements
 end returns an iterator just past the last element of a string
 erase removes elements from a string
 find find characters in the string
 find_first_not_of find first absence of characters
 find_first_of find first occurrence of characters
find_last_not_of find last absence of characters
 find_last_of find last occurrence of characters
 getline read data from an I/O stream into a string
 insert insert characters into a string
 length returns the length of the string
max_size returns the maximum number of elements that the string can hold
 push_back add an element to the end of the string
 rbegin returns a reverse_iterator to the end of the string
 rend returns a reverse_iterator to the beginning of the string
replace replace characters in the string
 reserve sets the minimum capacity of the string
 resize change the size of the string
 rfind find the last occurrence of a substring
 size returns the number of items in the string
substr returns a certain substring
 swap swap the contents of this string with another
 
Standard C String and Character
 atof converts a string to a double
 atoi converts a string to an integer
 atol converts a string to a long
 isalnum true if a character is alphanumeric
 isalpha true if a character is alphabetic
 iscntrl true if a character is a control character
 isdigit true if a character is a digit
 isgraph true if a character is a graphical character
 islower true if a character is lowercase
 isprint true if a character is a printing character
 ispunct true if a character is punctuation
 isspace true if a character is a space character
isupper true if a character is an uppercase character
 isxdigit true if a character is a hexidecimal character
 memchr searches an array for the first occurrence of a character
 memcmp compares two buffers
 memcpy copies one buffer to another
memmove moves one buffer to another
 memset fills a buffer with a character
strcat.html"> strcat concatenates two strings
 strchr finds the first occurance of a character in a string
strcmp compares two strings
strcoll compares two strings in accordance to the current locale
strcpy copies one string to another
strcspn searches one string for any characters in another
 strerror returns a text version of a given error code
 strlen returns the length of a given string
 strncat concatenates a certain amount of characters of two strings
strncmp compares a certain amount of characters of two strings
 strncpy copies a certain amount of characters from one string to another
 strpbrk finds the first location of any character in one string, in another string
 strrchr finds the last occurance of a character in a string
 strspn returns the length of a substring of characters of a string
 strstr finds the first occurance of a substring of characters
 strtod converts a string to a double
 strtok finds the next token in a string
 strtol converts a string to a long
 strtoul converts a string to an unsigned long
strxfrm converts a substring so that it can be used by string comparison functions
 tolower converts a character to lowercase
 toupper converts a character to uppercase