stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Wright <markwri...@internode.on.net>
Subject copy ostringstream ostream_iterator output out of order
Date Tue, 25 Mar 2008 10:41:47 GMT
Hello,

I compile and run following the program with stdcxx compiled from subversion
(svn update and compiled today) with Sun Studio 12 64 bit build mode 15D:

#include <string>
#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>

char char_array[] =
"Ptolemy, in the 2nd century AD, measured longitude eastward from a reference "
"meridian 2 degrees west of the Canary Islands. In 1493, Pope Alexander VI "
"established a line in the Atlantic west of the Azores to divide the "
"territories of Spain and Portugal. For many years, cartographers of these two "
"countries used this dividing line as the prime meridian. In 1570 the Dutch "
"cartographer Ortelius used the easternmost of the Cape Verde Islands. John "
"Davis, in his 1594 The Seaman's Secrets, used the Isle of Fez in the Canaries "
"because there the variation was zero.";

int main(int argc, char *argv[])
{
  std::string str(char_array);
  std::ostringstream m;
  std::copy(
    str.begin(),
    str.end(),
    std::ostream_iterator<char>(m));
  m << '\n';
  std::string result = m.str();
  std::cout << result;
  return 0;
}

With the Makefile:

ostr : ostr.o
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-o ostr ostr.o -L/h/goanna/1/a_5.10_m64/c/lib  -R/h/goanna/1/a_5.10_m64/c/lib -lstd15D

ostr.o : ostr.cpp
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-c ostr.cpp

clean:
	rm ostr ostr.o

I am wondering if I am doing something wrong, as the output is
out of order:

goanna% gmake      
CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-c ostr.cpp
CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-o ostr ostr.o -L/h/goanna/1/a_5.10_m64/c/lib  -R/h/goanna/1/a_5.10_m64/c/lib -lstd15D
goanna% ./ostr     
the Canaries because there the variation was zero.
eastward from a reference meridian 2 degrees west of the Canary Islands. In 1493, Pope Alexander
VI established a line in the Atlantic west of the Azores to divide the territories of Spain
and Portugal. For many years, cartographers of these two countries used this dividing line
as the prime meridian. In 1570 the Dutch cartographer Ortelius used the easternmost of the
Cape Verde Islands. John Davigoanna% 

Thanks, Mark

-- 

Mime
View raw message