Changes in tests/strstream.cfa [091011a:c7015e6b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/strstream.cfa
r091011a rc7015e6b 1 //2 // Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo3 //4 // strstream.cfa --5 //6 // Author : Peter A. Buhr7 // Created On : Wed Apr 28 21:47:35 20218 // Last Modified By : Peter A. Buhr9 // Last Modified On : Wed Apr 28 21:50:02 202110 // Update Count : 311 //12 13 1 #include <fstream.hfa> 14 2 #include <strstream.hfa> 15 3 16 4 int main() { 17 18 char buf[size]; // output buffer 19 ostrstream osstr = { buf, size }; // bind output buffer/size 20 21 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; 22 10 23 osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y)); // same lines of output 24 25 26 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)); 27 15 28 // char buf2[] = "12 14 15 3.5 7e4"; // input buffer 29 30 31 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; 32 20 } 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.