source: src/examples/read.c @ 94980502

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 94980502 was 90c3b1c, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

compile CFA with C++11, further update refrat with lstlisting macros, support varags, enumeration initialization, add implicit separators to output streams, update example programs that print

  • Property mode set to 100644
File size: 1.3 KB
Line 
1//                               -*- Mode: C -*-
2//
3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
4//
5// The contents of this file are covered under the licence agreement in the
6// file "LICENCE" distributed with Cforall.
7//
8// read.c --
9//
10// Author           : Peter A. Buhr
11// Created On       : Wed Mar  2 16:56:02 2016
12// Last Modified By : Peter A. Buhr
13// Last Modified On : Wed Mar  2 16:56:44 2016
14// Update Count     : 2
15//
16
17#include <fstream>
18
19int main() {
20    char c;
21    short int si;
22    unsigned short int usi;
23    int i;
24    unsigned int ui;
25    long int li;
26    unsigned long int uli;
27    long long int lli;
28    unsigned long long int ulli;
29    float f;
30    double d;
31    long double ld;
32    float _Complex fc;
33    double _Complex dc;
34    long double _Complex ldc;
35    char s1[10], s2[10];
36
37    ifstream in;
38    open( &in, "read.data", "r" );
39
40    &in | &c
41        | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli
42        | &f | &d | &ld
43        | &fc | &dc | &ldc
44        | str( s1 ) | str( s2, 10 );
45
46    sout | c | ' ' | endl
47         | si | usi | i | ui | li | uli | lli | ulli | endl
48         | f | d | ld | endl
49         | f | "" | d | "" | ld | endl;
50
51    sepSet( sout, ", $" );
52    sout | fc | dc | ldc | endl
53         | sepOn | s1 | sepOff | s2 | endl
54         | s1 | "" | s2 | endl;
55}
56
57// Local Variables: //
58// tab-width: 4 //
59// compile-command: "cfa read.c" //
60// End: //
Note: See TracBrowser for help on using the repository browser.