213
213
FILE *fptr = fopen ( fnme, "rt" ) ;
215
char inputline [ 256 ] ;
215
char inputline [ 256 ] , *line ;
219
219
/* Read a header line */
220
fgets ( inputline, 256, fptr ) ;
220
line = fgets ( inputline, 256, fptr ) ;
222
222
/* Read a comment line */
223
fgets ( inputline, 256, fptr ) ;
223
line = fgets ( inputline, 256, fptr ) ;
225
225
/* Read the window title */
226
fgets ( inputline, 256, fptr ) ;
226
line = fgets ( inputline, 256, fptr ) ;
227
227
/* We assume here that this line will not exceed 79 characters plus a
228
228
newline (window_title is 80 characters long). That'll cause a buffer
229
229
overflow. For a simple program like this, though, we're letting it
232
232
sscanf ( inputline, "%[a-zA-Z0-9!@#$%^&*()+=/\\_-\" ]", window_title ) ;
234
234
/* Read a comment line */
235
fgets ( inputline, 256, fptr ) ;
235
line = fgets ( inputline, 256, fptr ) ;
237
237
/* Read the number of affine transformations */
238
fgets ( inputline, 256, fptr ) ;
238
line = fgets ( inputline, 256, fptr ) ;
239
239
sscanf ( inputline, "%d", &num_trans ) ;
241
241
affine = (AffineTrans *)malloc ( num_trans * sizeof(AffineTrans) ) ;
243
243
/* Read a comment line */
244
fgets ( inputline, 256, fptr ) ;
244
line = fgets ( inputline, 256, fptr ) ;
246
246
for ( i = 0; i < num_trans; i++ )
248
248
/* Read an affine transformation definition */
249
fgets ( inputline, 256, fptr ) ;
249
line = fgets ( inputline, 256, fptr ) ;
250
250
sscanf ( inputline, "%lf %lf %lf %lf %lf %lf", &affine[i].a00, &affine[i].a01,
251
251
&affine[i].a10, &affine[i].a11, &affine[i].b0, &affine[i].b1 ) ;