exists Function

Specifies whether a file exists.

inline bool exists(
   file_status Stat
);
template<class Path>
inline bool exists(
   const Path& Pval
);

Parameters

  • Stat
    A file_status object.

  • Pval
    A Path object. Path can be either a basic_path or a type that is derived from basic_path.

Return Value

The first function returns status_known(Stat) && Stat.type() != file_not_found.

The second function returns exists(status(Pval)).

Remarks

A file_status represents an existing file if the underlying file_type is known

Requirements

Header: filesystem

Namespace: std::tr2::sys

See Also

Reference

<filesystem>

status_known Function

status Function

file_type Enumeration

Other Resources

C++ Standard Library Header Files