#How can I push data into my buffer?

10 messages · Page 1 of 1 (latest)

late prism
#

How can I push data into that buffer?

let mut global_buffer: [u8; 10000] = [0; 10000];
#

I have a buffer of the same type and I want to push all of it's content into the global_buffer

proud helm
#

if you want to use an array then you have to keep track of where in the array you have to write

#

which will then allow you to write bytes into it

late prism
#

How can I implement that?
The local buffer:

let mut buffer = [0; 10000];
let n = stream.read(&mut buffer[..]).unwrap();
proud helm
#

make the buffer a Cursor<[u8; 10000]>

#

then write into it using std::io::Write