|
|
|
According to the previous discussion, we must do this:
|
|
/* ===========================================================
How to read ONE record USING the meta data
ONE record has n_fields fields according to the Meta Data
=========================================================== */
for ( int i = 0; i < n_fields; i++ )
{
/* --------------------------------------------------------------
HOW you access the i-th field depends on the TYPE of the field !
-------------------------------------------------------------- */
if ( dataDes[i].fieldType.equals("I") )
{
/* --------------------------------------------------------
Field i is an integer, use i_buf[i] to store the value
-------------------------------------------------------- */
intVar = file.ReadInt( ); // Store in an int type var
}
else
{
/* --------------------------------------------------------
Field i is an String, use c_buf[i] to store the value
-------------------------------------------------------- */
stringVar = in.nextLine(); // Store in a String type variable
}
}
|