32 for (
int j = 0; j < 65 && is.good (); j++)
36 cout << j <<
" " << pph[j] <<
" " << is.
error () << endl;
43 const int EXTRA_DATA = 3;
44 v.
resize (pph[15] + EXTRA_DATA);
46 for (
int j = 0; j < pph[15] + EXTRA_DATA && is.good (); j++)
53 cerr <<
"Error: " << is.
error() << endl;
57 int main (
int argc,
char *argv[])
61 cerr <<
"Usage: " << argv[0] <<
" PPFILE [MAXFIELDS]" << endl;
66 if (argc > 2) maxfields = strtol (argv[2], NULL, 10);
76 while (is.good() && field != maxfields)
83 if (is.
error () & 32)
return (EXIT_FAILURE);
86 if ((e = is.
error ()))
88 cerr <<
"Reading " << field <<
". header failed with error "
94 cout <<
"Field # " << setw(5) << field
95 <<
" -- STASH code " << setw(5) << pph[42]
96 <<
" -- PP code " << setw(4) << pph[23]
97 <<
" -- PP VCT " << setw(3) << pph[26] << endl;
101 if ((e = is.
error ()))
103 cerr <<
"Reading " << field <<
". data failed with error "
111 cerr <<
"Error reading from " << argv[1] << endl;
112 return (EXIT_FAILURE);
115 return (EXIT_SUCCESS);