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

本文详细介绍了C++中的标准库使用方法,包括不同头文件的功能与应用场景,并重点讲解了标准输入输出流如stdin、stdout和stderr的概念及用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

转载于:https://www.cnblogs.com/taoxu0903/archive/2009/02/22/1396018.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值