C++ #,##,stdin,stdout,stderr
2016-01-07 16:27
489 查看
<pre name="code" class="cpp">// 标准输入,标准输出,标准错误输出
/* Declare _iob[] array */ #ifndef _STDIO_DEFINED _CRTIMP FILE * __cdecl __iob_func(void); #endif /* _STDIO_DEFINED */
#ifndef _FILE_DEFINED struct _iobuf { char *_ptr; int _cnt; char *_base; int _flag; int _file; int _charbuf; int _bufsiz; char *_tmpfname; }; typedef struct _iobuf FILE; #define _FILE_DEFINED #endif
#ifndef _STDSTREAM_DEFINED#define stdin (&__iob_func()[0])#define stdout (&__iob_func()[1])#define stderr (&__iob_func()[2])#define _STDSTREAM_DEFINED#endif
/* * FILE descriptors; preset for stdin/out/err (note that the __tmpnum field * is not initialized) */ FILE _iob[_IOB_ENTRIES] = { /* _ptr, _cnt, _base, _flag, _file, _charbuf, _bufsiz */ /* stdin (_iob[0]) */ { _bufin, 0, _bufin, _IOREAD | _IOYOURBUF, 0, 0, _INTERNAL_BUFSIZ }, /* stdout (_iob[1]) */ { NULL, 0, NULL, _IOWRT, 1, 0, 0 }, /* stderr (_iob[3]) */ { NULL, 0, NULL, _IOWRT, 2, 0, 0 }, }; /* These functions are for enabling STATIC_CPPLIB functionality */ _CRTIMP FILE * __cdecl __iob_func(void) { return _iob; }
#:将其后面的宏参数进行字符串化操作(Stringfication),简单说就是在对它所引用的宏变量通过替换后在其左右各加上一个双引号
##:连接符(concatenator),用来将两个Token连接为一个Token。注意这里连接的对象是Token就行,而不一定是宏的变量
相关文章推荐
- Caffe C++API 提取任意一张图片的特征系列一----ImageData
- C和C++中存储区域详解(栈、堆、全局...)
- C语言:从文本文件中读取输入数据
- 【C++】鸡尾酒算法排序
- java调用c++生成的动态和静态库时遇到的问题
- C语言用igraph读取GML文件
- C++ 编写一个选课系统
- 关于使用Notepad++编译C/C++代码时,dos界面会出现中文乱码现象
- C++中线程的简单使用?
- 【C++专题】static_cast, dynamic_cast, const_cast探讨
- c++引用
- vector C++遍历最快方法
- C语言中的typedef跟define的区别
- C语言写的一个简单的计算器
- 在c++中尾递归,普通递归,循环的效率对比
- 【c/c++】Vector入门
- C语言学习之关键字第六讲
- Sicily 1390. Surprising Strings
- C++语言一个最简单的写入文件操作
- 03.C++类、this指针、static静态变量、构造函数、析构函数