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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -