This is so stupidly simple but I'm just having issues with it.
A text file has a header,
e.g.,
# Avizo BINARY-LITTLE-ENDIAN 2.1
define Lattice 496 384 470
Parameters {
AlignTransform {
slice0000 0 -0 -30 -1,
slice0001 0 -0 -30 -1,
slice0002 0 -0 -30 -1,
And I'm trying to read each of these lines using fscanf.
int i;
for ( i = 0; i < 10; i++ ) {
fscanf(fp, "%s\n", buf);
printf("%d) %s\n",i,buf);
}
resulting in this
0) #
1) Avizo
2) BINARY-LITTLE-ENDIAN
3) 2.1
4) define
5) Lattice
6) 496
7) 384
8) 470
9) Parameters
So it's parsing the whitespace instead of newlines. Not sure what's happening.