Skip to content

Commit 1fc0758

Browse files
committed
Fix the sample app.
1 parent 231b7b6 commit 1fc0758

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

samples/hello/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ extern crate neotron_sdk;
55

66
#[no_mangle]
77
extern "C" fn main() -> i32 {
8-
let stdout = neotron_sdk::FileHandle::new_stdout();
9-
neotron_sdk::write(stdout, b"Hello, world\n");
8+
let stdout = neotron_sdk::stdout();
9+
stdout.write(b"Hello, world\n").unwrap();
1010
0
1111
}
1212

src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,21 @@ pub fn free(_ptr: *mut core::ffi::c_void, _size: usize, _alignment: usize) {
282282
todo!()
283283
}
284284

285+
/// Get a handle for Standard Input
286+
pub fn stdin() -> File {
287+
File(file::Handle::new_stdin())
288+
}
289+
290+
/// Get a handle for Standard Output
291+
pub fn stdout() -> File {
292+
File(file::Handle::new_stdout())
293+
}
294+
295+
/// Get a handle for Standard Error
296+
pub fn stderr() -> File {
297+
File(file::Handle::new_stderr())
298+
}
299+
285300
/// Get the API structure so we can call APIs manually.
286301
///
287302
/// If you managed to not have `app_entry` called on start-up, this will panic.

0 commit comments

Comments
 (0)