I am trying to determine the path at compile time by passing:
-DDCROOTDEF='"/path/to/stuff"'
on the compilation line. Then I try to use this in code, for example:
char * ptr_path; strcpy(ptr_path, DCROOTDEF); strcat(ptr_path,"/MainCommons/CommonLib/fonts/Arial.ttf"); char *pftf=ptr_path; gdImageStringFT(pimg,brect,iclr,pftf,pts,ang,ixp,iyp, (char *)cbuf);
This gives me a segmentation error. However, if I try to print the line first:
char * ptr_path; strcpy(ptr_path, DCROOTDEF); strcat(ptr_path,"/MainCommons/CommonLib/fonts/Arial.ttf"); char *pftf=ptr_path; printf("%s\n",pftf); gdImageStringFT(pimg,brect,iclr,pftf,pts,ang,ixp,iyp, (char *)cbuf);
It works great. What complexity in char pointer do I not see here?
thanks
source share