Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
readDMAT.cpp File Reference
#include "readDMAT.h"
#include "verbose.h"
#include <cstdio>
#include <iostream>
#include <cassert>
+ Include dependency graph for readDMAT.cpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int readDMAT_read_header (FILE *fp, int &num_rows, int &num_cols)
 

Function Documentation

◆ readDMAT_read_header()

static int readDMAT_read_header ( FILE *  fp,
int &  num_rows,
int &  num_cols 
)
inlinestatic
28{
29 // first line contains number of rows and number of columns
30 int res = fscanf(fp,"%d %d",&num_cols,&num_rows);
31 if(res != 2)
32 {
33 return 1;
34 }
35 // check that number of columns and rows are sane
36 if(num_cols < 0)
37 {
38 fprintf(stderr,"IOError: readDMAT() number of columns %d < 0\n",num_cols);
39 return 2;
40 }
41 if(num_rows < 0)
42 {
43 fprintf(stderr,"IOError: readDMAT() number of rows %d < 0\n",num_rows);
44 return 3;
45 }
46 // finish reading header
47 char lf;
48
49 if(fread(&lf, sizeof(char), 1, fp)!=1 || !(lf == '\n' || lf == '\r'))
50 {
51 fprintf(stderr,"IOError: bad line ending in header\n");
52 return 4;
53 }
54
55 return 0;
56}

Referenced by igl::readDMAT(), and igl::readDMAT().

+ Here is the caller graph for this function: