Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
d88a7720
Commit
d88a7720
authored
Mar 06, 1994
by
Will Schroeder
Browse files
ENH: More robust reading of binary files.
parent
f3e39b6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/STLRead.cc
View file @
d88a7720
...
...
@@ -32,8 +32,8 @@ void vlSTLReader::Execute()
if
((
fp
=
fopen
(
this
->
Filename
,
"r"
))
==
NULL
)
{
fprintf
(
stderr
,
"%s: file %s not found
\n
"
,
this
->
GetClassName
(),
this
->
Filename
);
return
;
vlErrorMacro
(
<<
"File "
<<
this
->
Filename
<<
" not found
\n
"
);
return
;
}
newPts
=
new
vlFloatPoints
(
5000
,
10000
);
...
...
@@ -83,13 +83,16 @@ int vlSTLReader::ReadBinarySTL(FILE *fp, vlFloatPoints *newPts, vlCellArray *new
fread
(
header
,
1
,
80
,
fp
);
fread
(
&
ulint
,
1
,
4
,
fp
);
swap
.
Swap4
(
&
ulint
);
//
// Many .stl files contain bogus count. Hence we will ignore and read
// until end of file.
//
if
(
(
numTris
=
(
int
)
ulint
)
<=
0
)
{
vlErrorMacro
(
<<
"Bad binary STL file
\n
"
);
return
1
;
vlDebugMacro
(
<<
"Bad binary count ("
<<
numTris
<<
")
\n
"
);
}
for
(
i
=
0
;
fread
(
&
facet
,
48
,
1
,
fp
)
&&
i
<
numTris
;
i
++
)
while
(
fread
(
&
facet
,
48
,
1
,
fp
)
>
0
)
{
fread
(
&
ibuff2
,
2
,
1
,
fp
);
/* read extra junk */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment