I'm working on USB communication. Here every time the size of data from the host varies. To avoid this from host it will send the size of data before sending the data so i need to allocate the buffer of size which host sends.
The data from host is "5" it is a string i need to allocate a buffer of size 5. ex: rec_buff[5]. After reading the size from host.
Every time the size varies how can i do this with C code snippet. I have no idea how to do this. I used to work on java, i'm a newbie to C.
I need to do it without using dynamic memory allocation.
Any help will be appreciated.Thanks in advance.