do not segfault if reading ascii raw files. print error message and tell user to generate binary rawfile.

This commit is contained in:
Stefan Frederik 2022-07-26 12:05:28 +02:00
parent 9c1a9f38af
commit d86a422c59
1 changed files with 8 additions and 0 deletions

View File

@ -301,6 +301,14 @@ static int read_dataset(FILE *fd)
while((ptr = fgets(line, sizeof(line), fd)) ) {
/* after this line comes the binary blob made of nvars * npoints * sizeof(double) bytes */
if(!strcmp(line, "Values:\n")) { /* this is an ASCII raw file. We don't handle this (yet) */
free_rawfile(0);
dbg(0, "read_dataset(): ASCII raw files can not be read. "
"Use binary format in ngspice (set filetype=binary)\n");
tcleval("alert_ {read_dataset(): ASCII raw files can not be read. "
"Use binary format in ngspice (set filetype=binary)}");
return 0;
}
if(!strcmp(line, "Binary:\n")) {
int npoints = xctx->graph_npoints[xctx->graph_datasets];
if(xctx->graph_sim_type) {