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
Post a Comment