diff options
Diffstat (limited to 'libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp')
-rw-r--r-- | libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp index 1f3f457fb73..7800c1abe8b 100644 --- a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp +++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp @@ -19,9 +19,12 @@ int main() { + char temp1[L_tmpnam], temp2[L_tmpnam]; + tmpnam(temp1); + tmpnam(temp2); { - std::ofstream fs1("test1.dat"); - std::ofstream fs2("test2.dat"); + std::ofstream fs1(temp1); + std::ofstream fs2(temp2); fs1 << 3.25; fs2 << 4.5; fs1.swap(fs2); @@ -29,26 +32,26 @@ int main() fs2 << ' ' << 4.5; } { - std::ifstream fs("test1.dat"); + std::ifstream fs(temp1); double x = 0; fs >> x; assert(x == 3.25); fs >> x; assert(x == 4.5); } - remove("test1.dat"); + remove(temp1); { - std::ifstream fs("test2.dat"); + std::ifstream fs(temp2); double x = 0; fs >> x; assert(x == 4.5); fs >> x; assert(x == 3.25); } - remove("test2.dat"); + remove(temp2); { - std::wofstream fs1("test1.dat"); - std::wofstream fs2("test2.dat"); + std::wofstream fs1(temp1); + std::wofstream fs2(temp2); fs1 << 3.25; fs2 << 4.5; fs1.swap(fs2); @@ -56,21 +59,21 @@ int main() fs2 << ' ' << 4.5; } { - std::wifstream fs("test1.dat"); + std::wifstream fs(temp1); double x = 0; fs >> x; assert(x == 3.25); fs >> x; assert(x == 4.5); } - remove("test1.dat"); + remove(temp1); { - std::wifstream fs("test2.dat"); + std::wifstream fs(temp2); double x = 0; fs >> x; assert(x == 4.5); fs >> x; assert(x == 3.25); } - remove("test2.dat"); + remove(temp2); } |