Skip to content

Commit

Permalink
update example to not use stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Dec 23, 2022
1 parent a8a99cf commit 896d9f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fitsio/examples/reading_from_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// can use `Fitsfile::from_raw` to load a `FitsFile` from a file that was opened via
// `fits_open_memfile` in `cfitsio`.

#[cfg(all(target_pointer_width = "64", target_os = "linux"))]
use fitsio::errors::check_status;
#[cfg(all(target_pointer_width = "64", target_os = "linux"))]
use fitsio::{sys, FileOpenMode, FitsFile};
#[cfg(all(target_pointer_width = "64", target_os = "linux"))]
Expand All @@ -10,6 +12,7 @@ use std::io::Read;
#[cfg(all(target_pointer_width = "64", target_os = "linux"))]
fn main() {
// read the bytes into memory and return a pointer and length to the file

let (bytes, mut ptr_size) = {
let filename = "./testdata/full_example.fits";
let mut f = std::fs::File::open(filename).unwrap();
Expand Down Expand Up @@ -39,10 +42,7 @@ fn main() {
);
}

if status != 0 {
unsafe { sys::ffrprt(sys::stderr, status) };
panic!("bad status");
}
check_status(status).unwrap();

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

0 comments on commit 896d9f2

Please sign in to comment.