From 4a907749a669e2e619e4e0cea3db128d6e31d4b6 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 6 Sep 2021 23:00:10 +0200 Subject: [PATCH] Reading CIDER "Device Cross Section" failed if written in ASCII. Second point count flag enabled (for CIDER 2D only). --- src/frontend/rawfile.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index dda6f2e5c..053decd50 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -325,7 +325,7 @@ raw_read(char *name) { char *date = NULL; struct plot *plots = NULL, *curpl = NULL; char buf[BSIZE_SP], *s, *t, *r; - int flags = 0, nvars = 0, npoints = 0, i, j; + int flags = 0, nvars = 0, npoints = 0, i, j, k; int ndimpoints, numdims = 0, dims[MAXDIMS]; bool raw_padded = TRUE, is_ascii = FALSE; double junk; @@ -618,6 +618,16 @@ raw_read(char *name) { fprintf(cp_err, "Error: unable to read point count\n"); break; } +#ifdef CIDER + /* special for 2D CIDER: read second point count, + written by TWOprnSolution() in twoprint.c, line 323 */ + if (eq(curpl->pl_name, "Device Cross Section")) { + if (fscanf(fp, " %d", &k) != 1) { + fprintf(cp_err, "Error: unable to read second point count\n"); + break; + } + } +#endif for (v = curpl->pl_dvecs; v; v = v->v_next) { if (i < v->v_length) { if (flags & VF_REAL) {