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

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -