Jive reference manual
TextInput.cpp
/************************************************************************
*
* This example demonstrates the TextInput class.
*
***********************************************************************/
#include <jem/base/System.h>
#include <jem/base/array/utilities.h>
#include <jem/base/array/Array.h>
#include <jem/io/FileWriter.h>
#include <jem/io/FileReader.h>
using namespace jem;
using namespace jem::io;
//-----------------------------------------------------------------------
// run
//-----------------------------------------------------------------------
int run ()
{
Ref<Writer> out = newInstance<FileWriter> ( "output.data" );
Ref<Reader> in = newInstance<FileReader> ( "input.data" );
Array<double> value ( 10 );
for ( idx_t i = 0; i < value.size(); i++ )
{
read ( *in, value[i] );
}
sort ( value );
print ( *out, value );
out->flush ();
return 0;
}
//-----------------------------------------------------------------------
// main
//-----------------------------------------------------------------------
int main ()
{
return System::exec ( & run );
}