On this page
  1. FILE
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

FILE

Prev: __func__ | Up: builtins | Next: __LINE__
Rel: __LINE__, __func__
Ref: cppreference — FILE
Tags: #public #prog #c #builtins #tier/core


Availability

Built-in (Predefined Macro) — requires no #include header.

Syntax & Overview

__FILE__

Expands to a string literal containing the presumed name of the current source file.

Notes & Pitfalls

Example

#include <stdio.h>

int main(void) {
    fprintf(stderr, "[%s:%d] started\n", __FILE__, __LINE__);
}

Linked from

Related notes