~ubuntu-branches/ubuntu/trusty/libc++/trusty

« back to all changes in this revision

Viewing changes to libcxx/test/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp

  • Committer: Package Import Robot
  • Author(s): Andrej Belym
  • Date: 2012-06-02 19:25:47 UTC
  • Revision ID: package-import@ubuntu.com-20120602192547-b6ta950a8ckc9um2
Tags: upstream-1.0~svn160132
ImportĀ upstreamĀ versionĀ 1.0~svn160132

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===----------------------------------------------------------------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is dual licensed under the MIT and the University of Illinois Open
 
6
// Source Licenses. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
 
 
10
// <fstream>
 
11
 
 
12
// template <class charT, class traits = char_traits<charT> >
 
13
// class basic_ifstream
 
14
 
 
15
// explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
 
16
 
 
17
#include <fstream>
 
18
#include <cassert>
 
19
 
 
20
int main()
 
21
{
 
22
    {
 
23
        std::ifstream fs("test.dat");
 
24
        double x = 0;
 
25
        fs >> x;
 
26
        assert(x == 3.25);
 
27
    }
 
28
    {
 
29
        std::ifstream fs("test.dat", std::ios_base::out);
 
30
        double x = 0;
 
31
        fs >> x;
 
32
        assert(x == 3.25);
 
33
    }
 
34
    {
 
35
        std::wifstream fs("test.dat");
 
36
        double x = 0;
 
37
        fs >> x;
 
38
        assert(x == 3.25);
 
39
    }
 
40
    {
 
41
        std::wifstream fs("test.dat", std::ios_base::out);
 
42
        double x = 0;
 
43
        fs >> x;
 
44
        assert(x == 3.25);
 
45
    }
 
46
}