Easy Tutorial
❮ C Function Sinh C Exercise Example55 ❯

C Language Example - Output Current File Execution Code

C Language Examples

Output the current file execution code, where __FILE__ is the constant for the currently executing file.

Example

#include <stdio.h>
int main() {
    FILE *fp;
    char c;
    fp = fopen(__FILE__,"r");
    do {
         c = getc(fp);
         putchar(c);
    }
    while(c != EOF);
    fclose(fp);
    return 0;
}

Output result:

#include <stdio.h>
int main() {
    FILE *fp;
    char c;
    fp = fopen(__FILE__,"r");
    do {
         c = getc(fp);
         putchar(c);
    }
    while(c != EOF);
    fclose(fp);
    return 0;
}

C Language Examples

❮ C Function Sinh C Exercise Example55 ❯