[fs.path.generic.obs]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.path.generic.obs)

### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.generic.obs)

#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.generic.obs)

#### 31.12.6.5.7 Generic format observers [fs.path.generic.obs]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14725)

Generic format observer functions return strings formatted according to the[generic pathname format](fs.path.generic "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-1)

A single slash ('/') character is used as
the [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14731)

[*Example [1](#example-1)*:

On an operating system that uses backslash as
its [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]"),path("foo\\bar").generic_string() returns "foo/bar"[.](#2.sentence-1)

â *end example*]

[ð](#lib:generic_string,path)

`template<class EcharT, class traits = char_traits<EcharT>, class Allocator = allocator<EcharT>>
  basic_string<EcharT, traits, Allocator> generic_string(const Allocator& a = Allocator()) const;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14748)

*Returns*: The pathname in the generic format[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14752)

*Remarks*: All memory allocation, including for the return value, shall
be performed by a[.](#4.sentence-1)

Conversion, if any, is specified by[[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#4.sentence-2)

[ð](#lib:generic_system_encoded_string,path)

`std::string generic_system_encoded_string() const;
std::wstring generic_wstring() const;
std::u8string generic_u8string() const;
std::u16string generic_u16string() const;
std::u32string generic_u32string() const;
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14773)

*Returns*: The pathname in the generic format[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14777)

*Remarks*: Conversion, if any, is specified by [[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#6.sentence-1)

[ð](#lib:generic_display_string,path)

`std::string generic_display_string() const;
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14788)

*Returns*: format("{:g}", *this)[.](#7.sentence-1)

[*Note [1](#note-1)*:

The returned string is suitable for use with formatting ([[format.functions]](format.functions "28.5.5 Formatting functions"))
and print functions ([[print.fun]](print.fun "31.7.10 Print functions"))[.](#7.sentence-2)

â *end note*]
