std::experimental::source_location::file_name
來自 cppreference.com
< cpp | experimental | source_location
constexpr const char* file_name() const noexcept; |
(庫基礎 TS v2) | |
返回此物件所表示的當前原始檔名稱,以空終止位元組串表示。
目錄 |
[編輯] 引數
(無)
[編輯] 返回值
此物件所表示的當前原始檔名稱,以空終止位元組串表示。
[編輯] 示例
執行此程式碼
#include <experimental/source_location> #include <iostream> inline void print_this_file_name( const std::experimental::source_location& location = std::experimental::source_location::current()) { // Name of file that contains the call-site of this function. std::cout << "File: " << location.file_name() << '\n'; } int main() { print_this_file_name(); }
可能的輸出
File: main.cpp
[編輯] 參閱
返回此物件表示的行號 (public member function) | |
返回此物件表示的列號 (public member function) | |
返回此物件表示的函式名(如果有) (public member function) | |
C++ 文件,關於 檔名與行資訊
|