That's because the buffer you made can only be seen in the function.
Try making buf[] a global and maybe passing a pointer to buf[] as a function arg.
That's because the buffer you made can only be seen in the function.
Try making buf[] a global and maybe passing a pointer to buf[] as a function arg.