file_size Function

Returns the size, in bytes, of a file that has a specified name.

template<class Path>
unsigned long long file_size(
   const Path& Pval
);

Parameters

  • Pval
    An object of type Path. Path can be either a basic_path or a type that's derived from basic_path.

Return Value

The size, in bytes, of the file that's designated by Pval, or 0 if the size cannot be determined.

Requirements

Header: filesystem

Namespace: std::tr2::sys

See Also

Reference

<filesystem>

Other Resources

C++ Standard Library Header Files