hi i want a to convert cstring variable contents into char *; how can i convert it, actually problem is that cstring variable is of textbox n i want to pass the contents to a function which takes parameters as char *. Thanks!!!
getbuffer does'nt work , i get only the first character of string not the whole string, could there be any problem due to character set in windows ce?
It has a parameter where you can specify the number of characters. Refer - http://msdn2.microsoft.com/en-us/library/ms928943.aspx
look i have this problem Code: int let; CString browse_file_name = " \\system\\texFile.TXT"; const char * argument = browse_file_name.Getbuffer(browse_file_name.GetLength()); FILE * file = fopen(argument,"r"); if(!file) { let = GetLastError(); MessageBox(_T("ERROR! file not found ...")); exit(0); } else MessageBox(_T("OK File found ...")); now the thing is that the variable argument does not get the whole path , just "\" only.... please help i am using microsoft embedded vc++ compiler.
yes i am using the GetBuffer(); earlier that was a typing mistake,, still not getting the right output..., r u getting the whole string in the char * argument???
well god knows what's wrong then....... but i'll tell you it's not that simple i have found several queries similar to mine , but neither of the solutions provided there are useful. anyways thanks for your time
here is the correct solution use this version of fopen Code: int let; UpdateData(); const wchar_t * g_application_path = (LPCTSTR) m_browse_file; FILE * file = _tfopen(g_application_path ,_T("rb")); if(!file) { let = GetLastError(); MessageBox(_T("ERROR! file not found ...")); exit(0); } else MessageBox(_T("OK File found ...")); just wanted to help if any one had similar problem