Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!mace.cc.purdue.edu!fhg From: fhg@mace.cc.purdue.edu (J. F. Blake) Newsgroups: comp.lang.c Subject: Reading data Message-ID: <5273@mace.cc.purdue.edu> Date: 6 Aug 90 20:11:52 GMT Distribution: usa Organization: Purdue University Lines: 26 <> What would be the "best" way to read the following data? The code I have works fine, but I am interested accepted style. C 0.000000 0 0.000000 0 0.000000 0 0 0 0 H 1.100954 1 0.000000 0 0.000000 0 1 0 0 C 1.399112 1 119.509166 1 0.000000 0 1 2 0 C 1.399112 1 119.509166 1 180.000000 0 1 2 3 Currently I do the following: FILE *fpin, *fpout, *fopen(); char line[80], atomic_symbol[3]; int i, j, k; double x, y, z; while (fgets(line, 80, fpin) != NULL) { sscanf(line, "%s %lf %*d %lf %*d %lf %*d %d %d %d", atomic_symbol, &x, &y, &z, &i, &j, &k); } Thanks. Jim