接下来的几段将会讨论更多的关于C运行库文件函数的细节,这些函数在过去生成C运行库,
以前这些C运行库用来自动匹配windows应用程序,
但是这些函数在标准C/C++函数不在可用。
We will start with category, then the functions available in that category and finally followed by program examples that use some of the functions.
The functions discussed here mostly deal with directories and files.
For complete information please refer to Microsoft Visual C++ documentation (online MSDN: Microsoft Visual C++).
As a remainder, the following are the things that must be fully understood when you want to use a function, and here, _chsize() is used as an example.
下面将按类分析,并且将介绍各个类中所包含的函数,最后接下来的程序实例会使用所介绍的函数。
这里讨论的函数主要是处理目录和文件功能。
如果要获取完整的消息,请参考MSVC的帮助文档(在线帮助系统MSDN)。
当你使用函数的时候,你必须要完全理解所使用的函数,在这里我们将以_chsize()函数为例说明。
2 What is the use of the function? This will match with \"what are you going to do or create?\"
Keep in mind that to accomplish some of the tasks you might need more (several) than one function. For example:
_chsize() used to change the file size.
3 What is the function prototype, so we know how to write (call) a proper syntax of the function. For example:
int _chsize(int handle, long size);
4 From the function prototype, how many parameters, the order and what are their types, so we can create the needed variables. For example:
5 What header files need to be included? For example the _chsize needs:
<io.h>
6 What is the return type and value? For example:
_chsize() returns 0 if the file size is successfully changed. A return value of –1 indicates an error: errno is set to EACCES
if the specified file is locked against access, to EBADF if the specified file is read-only or the handle is invalid, or to ENOSPC if no space is left on the device.
2