char array prblm
-
hi, i have a char array in which i m getting path of current module.i want to convert it into string before loading it.hw can i do that?
-
hi, i have a char array in which i m getting path of current module.i want to convert it into string before loading it.hw can i do that?
You actually asked this question 10 minutes ago in C# forum. If you want to convert char array to string in C++ you could use: 1) The constructor of
std::string
- here[^]. 2) The assignment operator ofstd::string
- hete[^]. Example:const char* szChars = "ABCD";
// Using constructor
std::string strFromChars(szChars);// Using assignment operator
std::string strFromChars;
strFromChars = szChars; -
hi, i have a char array in which i m getting path of current module.i want to convert it into string before loading it.hw can i do that?
char arr[MAX_PATH];
std::string str = arr;OR
wchar_t arr[MAX_PATH];
std::wstring str = arr;OR
TCHAR arr[MAX_PATH];
CString str = arr;«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
hi, i have a char array in which i m getting path of current module.i want to convert it into string before loading it.hw can i do that?
Which type of string you mean.? CString or std::string? for CString--- CString strPath(szPathName); for std::string-- const char* szPathName; std::string strPath; ... szPathName = "c:\\Test"; strPath = szPathName;
-
Which type of string you mean.? CString or std::string? for CString--- CString strPath(szPathName); for std::string-- const char* szPathName; std::string strPath; ... szPathName = "c:\\Test"; strPath = szPathName;
thanx all and nuri ismail i mistakenly posted in c# forum i m doing it in vc++