std::source_location::file_name
cppreference.net에서 가져옴
constexpr const char* file_name() const noexcept;
|
(C++20부터) | |
이 객체로 표현되는 현재 소스 파일의 이름을 널 종료 바이트 문자열로 반환합니다.
매개변수
(없음)
반환값
이 객체가 나타내는 현재 소스 파일의 이름으로, 널 종료 바이트 문자열로 표현됩니다.
예제
이 코드 실행
#include <iostream> #include <source_location> void print_this_file_name( std::source_location location = std::source_location::current()) { // 이 함수의 호출 위치를 포함하는 파일 이름 std::cout << "File: " << location.file_name() << '\n'; } int main() { #line 1 "cppreference.cpp" print_this_file_name(); }
출력:
File: cppreference.cpp
참고 항목
|
이 객체가 나타내는 줄 번호를 반환합니다
(public member function) |
|
|
이 객체가 나타내는 열 번호를 반환합니다
(public member function) |
|
|
이 객체가 나타내는 함수의 이름을 반환합니다 (있는 경우)
(public member function) |
|
평가가
stacktrace_entry
로 나타나는 표현식이나 문장을 어휘적으로 포함하는 소스 파일의 이름을 가져옵니다
(
std::stacktrace_entry
의 public member function)
|
|
| 파일 이름과 줄 정보 | |