how will i pass the path of a file name to void *buffer using c language? -


implementing processrequest , wants copy data buffer return caller

the function signature following :
int processrequest(hcst hcst, void *buffer, short tag, short status)

path name of file stored in char src [40];

you need :

int processrequest(int hcst, void *buffer, short tag, short status) {   // stub function    static char test[] = "test";   strcpy(buffer, test);   return 0; }  ... char src [40]; ... processrequest(myhcst, src, mytag, mystatus); /* src contains "test" */ 

this code simple , unsafe because processrequest doesn't know size of buffer , hence may potentially overwrite past end of buffer.


Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -