zoukankan      html  css  js  c++  java
  • c #include "" 和 <>

    <>先去系统目录中找头文件,如果没有在到当前目录下找。所以像标准的头文件 stdio.h、stdlib.h等用这个方法。 


    而""首先在当前目录下寻找,如果找不到,再到系统目录中寻找。 这个用于include自定义的头文件,让系统优先使用当前目录中定义的。 



    When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. 

    This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable 

    C代码  收藏代码
    1. INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;   



    using the #include  version of file inclusion, the compiler first checks the C:COMPILERINCLUDE 
    directory for the specified file. If the file is not found there, the compiler then checks the S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory. 

    The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. 

    Using the #include &ldquo;file&rdquo; version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory. 

      • The #include  method of file inclusion is often used to include standard headers such as stdio.h or stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler&rsquo;s standard include file directory.




      • The #include &ldquo;file&rdquo; method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.
  • 相关阅读:
    linuxepoll研究 Geek_Ma 博客园
    socklen_t 类型 blueliuyun的专栏 博客频道 CSDN.NET
    自己动手写web服务器一(浏览器的访问信息) 任天胜的个人空间 开源中国社区
    UNIX Domain Socket IPC blueliuyun的专栏 博客频道 CSDN.NET
    How to use epoll? A complete example in C
    gzip头部格式 任天胜的个人空间 开源中国社区
    CWnd与HWND的区别与转换
    MFC 框架各部分指针获取方式
    windows 注册表的编程
    VS2010创建C++项目类向导和智能感知不可用
  • 原文地址:https://www.cnblogs.com/silentjesse/p/3214450.html
Copyright © 2011-2022 走看看