call strcpy???????????
-
hi there, following problem: char g_szOutputFile[_MAX_PATH]; CString pathname; now i want to copy pathname into g_szOutputFile and i call strcpy(g_szOutputFile,pathname); but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char? thank's in advance, patrick:confused:
-
hi there, following problem: char g_szOutputFile[_MAX_PATH]; CString pathname; now i want to copy pathname into g_szOutputFile and i call strcpy(g_szOutputFile,pathname); but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char? thank's in advance, patrick:confused:
-
hi there, following problem: char g_szOutputFile[_MAX_PATH]; CString pathname; now i want to copy pathname into g_szOutputFile and i call strcpy(g_szOutputFile,pathname); but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char? thank's in advance, patrick:confused:
I'm pretty new to C++, but it seems to me that you can just cast the CString. I believe you need an LPTCSTR type for the strcpy function, so I think you can do a simple cast from CString to the LPTCSTR type: ...(LPTCSTR)pathname... You may need to cast it again such as: ...(LPTSTR)(LPTCSTR)pathname... David.
-
I'm pretty new to C++, but it seems to me that you can just cast the CString. I believe you need an LPTCSTR type for the strcpy function, so I think you can do a simple cast from CString to the LPTCSTR type: ...(LPTCSTR)pathname... You may need to cast it again such as: ...(LPTSTR)(LPTCSTR)pathname... David.
-
You can try it as such: char szFileName[MAX_LENGTH]; CString pathname = "c:\temp"; strcpy(szFileName, (const char*)pathname);:suss: :cool: :cool:
-
hi there, following problem: char g_szOutputFile[_MAX_PATH]; CString pathname; now i want to copy pathname into g_szOutputFile and i call strcpy(g_szOutputFile,pathname); but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char? thank's in advance, patrick:confused:
-
hi there, following problem: char g_szOutputFile[_MAX_PATH]; CString pathname; now i want to copy pathname into g_szOutputFile and i call strcpy(g_szOutputFile,pathname); but this doesn't look like it is working, are there any other functions i can call to convert a CString into a char? thank's in advance, patrick:confused: