operator<<,>>(std::experimental::filesystem::path) - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# operator<<,>>(std::experimental::filesystem::path)

From cppreference.com
< cpp‎ | experimental‎ | fs‎ | path

template< class CharT, class Traits > std::basic_ostream<CharT,Traits>& operator<<( std::basic_ostream<CharT,Traits>& os, const path& p ); | (1) | (filesystem TS)
template< class CharT, class Traits > std::basic_istream<CharT,Traits>& operator>>( std::basic_istream<CharT,Traits>& is, path& p ); | (2) | (filesystem TS)

Performs stream input or output on the path `p`. std::quoted is used so that spaces are not truncation when later read by stream input operator.

### [edit] Parameters

os | - | stream to perform output on
is | - | stream to perform input on
p | - | path to insert or extract

### [edit] Return value

1) os
2) is

### [edit] Exceptions

(none)

### [edit] Possible implementation

First version
    template< class CharT, class Traits >
    std::basic_ostream<CharT,Traits>&
        operator<<( std::basic_ostream<CharT,Traits>& os, const path& p )
    {
        os << std::quoted(p.string<CharT,Traits>());
        return os;
    }
Second version
    template< class CharT, class Traits >
    std::basic_istream<CharT,Traits>&
        operator>>( std::basic_istream<CharT,Traits>& is, path& p )
    {
        std::basic_string<CharT, Traits> t;
        is >> std::quoted(t);
        p = t;
        return is;
    }

### [edit] Example

| This section is incomplete Reason: no example

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/path/operator_ltltgtgt&oldid=78121"
Category:

- Todo no example