M
m_schellens
I want to sort dome output from
a routine which writes to an ostream.
Following is what I am doing now and it works, but it looks
overyly complicated to me.
I assume that there is an easier way (avoiding any char[] buffer).
Any suggestions?
Thanks,
Marc
stringstream strS;
for( SizeT i=0; i<nEnv; ++i)
{
help_item( &strS, i); // writes one line about some property #i
}
deque<DString> toSort;
for( SizeT i=0; i<nEnv; ++i)
{
char buf[ 256];
strS.getline( buf, 256);
toSort.push_back( buf);
}
sort( toSort.begin(), toSort.end());
for( SizeT i=0; i<nEnv; ++i)
{
cout << toSort[ i] << endl;
}
a routine which writes to an ostream.
Following is what I am doing now and it works, but it looks
overyly complicated to me.
I assume that there is an easier way (avoiding any char[] buffer).
Any suggestions?
Thanks,
Marc
stringstream strS;
for( SizeT i=0; i<nEnv; ++i)
{
help_item( &strS, i); // writes one line about some property #i
}
deque<DString> toSort;
for( SizeT i=0; i<nEnv; ++i)
{
char buf[ 256];
strS.getline( buf, 256);
toSort.push_back( buf);
}
sort( toSort.begin(), toSort.end());
for( SizeT i=0; i<nEnv; ++i)
{
cout << toSort[ i] << endl;
}