<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # C 程序:顯示自己的源代碼作為輸出 > 原文: [https://www.programiz.com/c-programming/examples/source-code-output](https://www.programiz.com/c-programming/examples/source-code-output) #### 在此示例中,您將學習使用`__FILE__`宏顯示程序的源代碼。 要理解此示例,您應該了解以下 [C 編程](/c-programming "C tutorial")主題: * [C 預處理器和宏](/c-programming/c-preprocessor-macros) * [C 文件處理](/c-programming/c-file-input-output) * * * 盡管這個問題看起來很復雜,但是該程序的概念很簡單。 顯示與編寫源代碼相同的文件中的內容。 ![Procedure to display its own source code in C programming](https://img.kancloud.cn/bf/b7/bfb757673e6d3fe6f4065b2da176d2b6_264x199.png) 在 C 編程中,有一個名為`__FILE__`的預定義宏,該宏給出了當前輸入文件的名稱。 ```c #include <stdio.h> int main() { ? // location the current input file. printf("%s",__FILE__); } ``` * * * ### 顯示自己的源代碼的程序 ```c #include <stdio.h> int main() { FILE *fp; int c; ? // open the current input file fp = fopen(__FILE__,"r"); do { c = getc(fp); // read character putchar(c); // display character } while(c != EOF); // loop until the end of file is reached ? fclose(fp); return 0; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看