1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-12-12 11:29:50 +00:00
UltimateTrainingModpack/src/lib.rs

31 lines
612 B
Rust
Raw Normal View History

2020-04-08 04:21:52 +00:00
#![no_std]
#![feature(proc_macro_hygiene)]
2020-04-08 04:21:52 +00:00
use skyline::{
libc::{fopen, FileOpenMode, fwrite_slice, fclose},
c_str
};
#[skyline::main]
2020-04-08 04:21:52 +00:00
pub fn main() {
2020-04-08 05:13:06 +00:00
println!("Hello from Skyline Rust Plugin!\n");
2020-04-08 04:21:52 +00:00
2020-04-08 05:13:06 +00:00
for i in 0..3 {
println!("{}", i);
2020-04-08 04:21:52 +00:00
}
println!("Writing to file!");
write_to_file("sd:/test.txt\0", "test test test test");
println!("Done writing to file!");
}
fn write_to_file(file: &str, contents: &str) {
unsafe {
let file = fopen(c_str(file), FileOpenMode::Write);
fwrite_slice(contents.as_bytes(), file);
fclose(file);
2020-04-09 02:39:10 +00:00
}
2020-04-08 04:21:52 +00:00
}