Changeset 091011a


Ignore:
Timestamp:
Apr 28, 2021, 10:04:07 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c132d50
Parents:
99b2407
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/strstream.cfa

    r99b2407 r091011a  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo
     3//
     4// strstream.cfa --
     5//
     6// Author           : Peter A. Buhr
     7// Created On       : Wed Apr 28 21:47:35 2021
     8// Last Modified By : Peter A. Buhr
     9// Last Modified On : Wed Apr 28 21:50:02 2021
     10// Update Count     : 3
     11//
     12
    113#include <fstream.hfa>
    214#include <strstream.hfa>
    315
    416int main() {
    5     enum { size = 256 };
    6     char buf[size];
    7     ostrstream osstr = { buf, size };
    8     int i = 3, j = 5, k = 7;
    9     double x = 12345678.9, y = 98765.4321e-11;
     17        enum { size = 256 };
     18        char buf[size];                                                                         // output buffer
     19        ostrstream osstr = { buf, size };                                       // bind output buffer/size
     20        int i = 3, j = 5, k = 7;
     21        double x = 12345678.9, y = 98765.4321e-11;
    1022
    11     osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
    12     write( osstr );
    13     printf( "%s", buf );
    14     sout | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
     23        osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y)); // same lines of output
     24        write( osstr );
     25        printf( "%s", buf );
     26        sout | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
    1527
    16     // char buf2[] = "12 14 15 3.5 7e4";
    17     // istrstream isstr = { buf2 };
    18     // isstr | i | j | k | x | y;
    19     // sout | i | j | k | x | y;
     28        // char buf2[] = "12 14 15 3.5 7e4";                                    // input buffer
     29        // istrstream isstr = { buf2 };
     30        // isstr | i | j | k | x | y;
     31        // sout | i | j | k | x | y;
    2032}
     33
     34// Local Variables: //
     35// tab-width: 4 //
     36// compile-command: "cfa strstream.cfa" //
     37// End: //
Note: See TracChangeset for help on using the changeset viewer.