Several Need-To-Know(assert/stdin/stdout/CString/Standard C++ Library)

assert(CRT)
#include <assert.h>
void assert( int expression );

stdio.h VS cstdio
If you are writing c code, please use stdio.h; if c++, please use cstdio. Functionally, these two header files are the same. One difference is that all functions in cstdio is under namespace std, which is in order to make stdio.h, etc c library functions to be part of STL.
Other examples: cstring VS string.h;
And cctype (ctype.h): there are a set of functions like isdigit,isalpha, etc.

stdin, stdout, stderr (CRT)
These are standard streams for input, output, and error output.
By default, standard input is read from the keyboard, while standard output and standard error are printed to the screen.
These pointers can be used as arguments to functions. Some functions, such as getchar and putchar, use stdin and stdout automatically.
These pointers are constants, and cannot be assigned new values. The freopen function can be used to redirect the streams to disk files or to other devices. The operating system allows you to redirect a program's standard input and output at the command level.

Visual C++ Libraries
It contains a lot of libraries. Should know the classification clearly.

1. ATL
2. MFC
3. ATL/MFC shared
Beginning with Visual C++ .NET 2002, several existing MFC utility classes were rewritten or revised to reduce their dependencies on other MFC classes. These utility classes can now be used in any native C++ project. This section only includes classes that were previously available to MFC projects and have now been shared, plus a few new classes related to the changes in CString. It does not include the ATL and ATL Server classes, which can be used in any native C++ project type by inclusion of the appropriate header.

4. CRT
5. Standard C++ Library
Let's get an overview of this library directly by its header files diagram:
Table One---------------------------------------

<algorithm>

<bitset>

<complex>

<deque>

<exception>

<fstream>

<functional>

<hash_map>

<hash_set>

<iomanip>

<ios>

<iosfwd>

<iostream>

<iso646.h>

<istream>

<iterator>

<limits>

<list>

<locale>

<map>

<memory>

<new>

<numeric>

<ostream>

<queue>

<set>

<sstream>

<stack>

<stdexcept>

<streambuf>

<string>

<strstream>

<utility>

<valarray>

<vector>

 

Table Two-------------------------------------------------------

<cassert>

<cctype>

<cerrno>

<cfloat>

<ciso646>

<climits>

<clocale>

<cmath>

<csetjmp>

<csignal>

<cstdarg>

<cstddef>

<cstdio>

<cstdlib>

<cstring>

<ctime>

<cwchar>

<cwctype>

CString--ATL/MFC shared class
Note: there should always be a Wrapper to handle string in c++.
TCHAR--   Where you would use char.
LPTSTR--  Where you would use char*.
LPCTSTR-- Where you would use const char*.
String Manipulation (CRT) functions can be got from here:http://msdn.microsoft.com/en-us/library/f0151s4x(VS.80).aspx
Note: use _tcslwr_s to lower cases.

posted @ 2009-02-22 20:10  能巴  阅读(366)  评论(0编辑  收藏  举报