Przeglądaj źródła

Use a null-terminated string for the file name

Lucas Stadler 11 lat temu
rodzic
commit
a15fe17b56
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      rust/coffi/src/main.rs

+ 1 - 1
rust/coffi/src/main.rs

43
    unsafe {
43
    unsafe {
44
        let mut img: png_image = std::mem::zeroed();
44
        let mut img: png_image = std::mem::zeroed();
45
        print_img(&img);
45
        print_img(&img);
46
        let res = png_image_begin_read_from_file(&mut img, "mei.png".as_ptr());
46
        let res = png_image_begin_read_from_file(&mut img, "mei.png\0".as_ptr());
47
        println!("read_from_file: {}", res);
47
        println!("read_from_file: {}", res);
48
        print_img(&img);
48
        print_img(&img);
49
    }
49
    }