76 lines
2.4 KiB
Plaintext
76 lines
2.4 KiB
Plaintext
|
Hello, world via cout
|
||
|
Hello, world via cerr
|
||
|
enter a char:c = "a"
|
||
|
enter three integers (short, int, long):first = 123 via dec = 123
|
||
|
second = 4567 via form = 4567 = 010727 via cout.form = 4567 = 0x11d7
|
||
|
third = 89012 via hex = 15bb4
|
||
|
enter a float then a double:first = 123.456
|
||
|
second = -0.012
|
||
|
enter 5 characters separated with spaces:first = 1
|
||
|
rest = 2 3 4 5
|
||
|
A 10-character buffer: abcdefghi
|
||
|
|
||
|
Making streams sout and sin...contents of file:
|
||
|
Thisfilehasonelinetestingoutputstreams.
|
||
|
Making File tf ... first line of file:
|
||
|
This is the first and only line of this file.
|
||
|
next char = 10
|
||
|
reopening tempfile, appending: Now there is a second line.
|
||
|
First 10 chars via raw system read after reopen for input:
|
||
|
This is th
|
||
|
Contents after raw lseek to pos 5:
|
||
|
is the first and only line of this file.
|
||
|
Now there is a second line.
|
||
|
|
||
|
Making SFile rf...odd elements of file in reverse order:
|
||
|
(i = 9 c = j d = 0.009)
|
||
|
(i = 7 c = h d = 0.007)
|
||
|
(i = 5 c = f d = 0.005)
|
||
|
(i = 3 c = d d = 0.003)
|
||
|
(i = 1 c = b d = 0.001)
|
||
|
|
||
|
Making PlotFile pf ...(You may delete or attempt to plot plot.out)
|
||
|
creating ostrstream...
|
||
|
with contents:
|
||
|
This is a string-based stream.
|
||
|
With two lines.
|
||
|
using it to create istrstream...
|
||
|
with contents:
|
||
|
This is a string-based stream.
|
||
|
With two lines.
|
||
|
Testing string-based stream using strstream.
|
||
|
|
||
|
Making filebuf streams fout and fin...contents of file:
|
||
|
Thisfilehasonelinetestingoutputstreams.
|
||
|
|
||
|
This is line 1 of ftmp0
|
||
|
This is line 2 of ftmp0
|
||
|
|
||
|
This is line 1 of ftmp1
|
||
|
This is line 2 of ftmp1
|
||
|
|
||
|
This is line 1 of ftmp2
|
||
|
This is line 2 of ftmp2
|
||
|
|
||
|
5.50+6.25 = 1.175e+01
|
||
|
Previous line has 21 characters
|
||
|
Previous line has +32 characters
|
||
|
+__34567(dec) = 0x__8707(hex) = _0103407(oct) [showbase on]
|
||
|
+__34567(dec) = ____8707(hex) = __103407(oct) [showbase off]
|
||
|
-__34567(dec) = 0x__78f9(hex) = __074371(oct) [showbase on]
|
||
|
-__34567(dec) = ____78f9(hex) = ___74371(oct) [showbase off]
|
||
|
______+0(dec) = _____0x0(hex) = _______0(oct) [showbase on]
|
||
|
______+0(dec) = _______0(hex) = _______0(oct) [showbase off]
|
||
|
___34567(dec) = __0X8707(hex) = _0103407(oct) [showbase on]
|
||
|
___34567(dec) = ____8707(hex) = __103407(oct) [showbase off]
|
||
|
-34567__(dec) = 0X78F9__(hex) = 074371__(oct) [showbase on]
|
||
|
-34567__(dec) = 78F9____(hex) = 74371___(oct) [showbase off]
|
||
|
0 (dec) = 0X0 (hex) = 0 (oct) [showbase on]
|
||
|
0 (dec) = 0 (hex) = 0 (oct) [showbase off]
|
||
|
Final names & states:
|
||
|
cin: (stdin) 0
|
||
|
cout: (stdout) 0
|
||
|
cerr: (stderr) 0
|
||
|
|
||
|
end of test.
|