Skip to content

Commit adc629e

Browse files
committed
update example to not use stderr
1 parent a8a99cf commit adc629e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

fitsio/examples/reading_from_memory.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use std::io::Read;
1010
#[cfg(all(target_pointer_width = "64", target_os = "linux"))]
1111
fn main() {
1212
// read the bytes into memory and return a pointer and length to the file
13+
14+
use fitsio::errors::check_status;
1315
let (bytes, mut ptr_size) = {
1416
let filename = "./testdata/full_example.fits";
1517
let mut f = std::fs::File::open(filename).unwrap();
@@ -39,10 +41,7 @@ fn main() {
3941
);
4042
}
4143

42-
if status != 0 {
43-
unsafe { sys::ffrprt(sys::stderr, status) };
44-
panic!("bad status");
45-
}
44+
check_status(status).unwrap();
4645

4746
let mut f = unsafe { FitsFile::from_raw(fptr, FileOpenMode::READONLY) }.unwrap();
4847
f.pretty_print().expect("pretty printing fits file");

0 commit comments

Comments
 (0)