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!!!
|
Go4Expert Member
|
|
| 9Oct2007,19:01 | #1 |
|
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!!!
|
|
Go4Expert Founder
|
![]() |
| 9Oct2007,21:03 | #2 |
|
Use the GetBuffer function but remember to use the ReleaseBuffer after you are done.
|
|
Go4Expert Member
|
|
| 10Oct2007,12:57 | #3 |
|
could you give me a snippet plz. i am working on windows ce actually
|
|
Go4Expert Member
|
|
| 10Oct2007,13:34 | #4 |
|
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?
|
|
Go4Expert Founder
|
![]() |
| 10Oct2007,13:40 | #5 |
|
If you are using some compiler and an IDE you should be fine using the . to get the function.
|
|
Go4Expert Member
|
|
| 10Oct2007,15:55 | #6 |
|
i am using microsoft embedded c++ , compiler
n no probs with .(dot). |
|
Go4Expert Founder
|
![]() |
| 10Oct2007,15:58 | #7 |
|
So you should be able to use the functions I mention above. Why don't you give a try.
|
|
Go4Expert Member
|
|
| 10Oct2007,16:59 | #8 |
|
i tried but getbuffer() only gives me the first character of the string not the whole string
|
|
Go4Expert Founder
|
![]() |
| 10Oct2007,18:48 | #9 |
|
It has a parameter where you can specify the number of characters. Refer - http://msdn2.microsoft.com/en-us/library/ms928943.aspx
|
|
Go4Expert Member
|
|
| 11Oct2007,12:41 | #10 |
|
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 ..."));
please help i am using microsoft embedded vc++ compiler. Last edited by shabbir; 11Oct2007 at 13:01.. Reason: Code block |