let mut world_tiles = vec!["null"];
world_tiles[0] = "*";
for i in 1..1000000 {
world_tiles.push("*");
}
let mut layer_path = format!("saves/{}/layer_150.txt",name.trim());
let mut world_file = File::create(layer_path).expect("Uh oh");
world_file.write_all(world_tiles.as_bytes()).expect("Uh Oh....");
as_bytes
is on str
, not on Vec
.
How do i write a vec to a .txtx file then?
for tile in &world_tiles {
world_file.write_all(tile.as_bytes()).expect("Uh Oh....");
}
ok
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.