|
Something like this:
CString str; // init'd this already somewhere
wchar_t *wCharBuff = new wchar_t[strlen(str)+1];
wcscpy(wCharBuff,str);
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
_AnsHUMAN_ wrote: wchar_t *wCharBuff = new wchar_t[strlen(str)+1];
You're sure that's right?
PS: Why not let him read those articles instead of giving him 'da codez'? It's been almost six months since he's asking this kind of questions.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote:
You're sure that's right? Smile
yeah! +1 would stand for the delimiter
Rajesh R Subramanian wrote: It's been almost six months since he's asking this kind of questions.
I forgot to set the timer when he asked such a question for the first time.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
_AnsHUMAN_ wrote: yeah! +1 would stand for the delimiter
1? If it were Unicode (which it is), then it must be 2! Or rather sizeof(TCHAR)*1 , which is the neutral way of manipulating it.
You were also using strlen with a Unicode string in your answer to the OP!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
You're both assuming UNICODE is defined and not defined.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Absolutely! He didn't get it even after I asked him to check it.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Well, I got it after seeing your question!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why do you need such a conversion?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i m using this function wcstombs
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: i m using this function wcstombs
Well, your sentence adds just a bit of confusion to my understanding of the problem.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Well, your sentence adds just a bit of confusion to my understanding of the problem.
I think he even doesn't understand himself what he is trying to achieve
|
|
|
|
|
in this function wcstombs the second variable is wchar_t * type.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Yeah, so it confirms that you don't understand what you are trying to do. Did you read the articles that were given to you already more than enough ? Why do you keep asking and asking and asking always the same type of questions instead of trying to understand the concept (by reading the articles) ? The concept it rather simple to understand, so why do you refuse to learn something ? Do you plan to increase your knowledge by learning new things one day or do you prefer to spend the rest of your life asking technical questions on forums because you refuse to learn anything ?
|
|
|
|
|
Very neatly said.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Of course I am . I think I suggested the article at least 3 or 4 times already plus all the time you, Carlo, David, Stuart and half the population of CP already suggested him too (ok, maybe a bit exagerated, but not too far from reality ). I think if he still didn't get the point, then we can't do anything for him anymore...
|
|
|
|
|
hello,
im bit new to MFC, actually i have to write an MFC application, say it depends on three DLLs but not simultaneously, The function names are same in all 3 DLLs but with the changed functionality. any how i guess i cannot include all these 3 dlls in the project settings, because of the ambigious functions in each DLLs. Can any provide me a solution for this
-thanks aravind
|
|
|
|
|
You need to use explicit DLL linking. Here's an example. Let us say the function is called Test and has the same signature in all three DLLs (because that simplifies things), which is int Test(int) . Then we can do this:
typedef int (*pTest)(int);
pTest GetTestFnFromDll(LPCTSTR dllName)
{
HMODULE hDll = LoadLibrary(dllName);
if (!hDll) return 0;
return (pTest)GetProcAddress(hDll, "Test");
}
int main()
{
pTest aTestFn = GetTestFnFromDll(_T("first.dll"));
if (aTestFn)
std::cout << aTestFn(10) << std::endl;
pTest aSecondTestFn = GetTestFnFromDll(_T("second.dll"));
if (aSecondTestFn)
std::cout << aSecondTestFn(10) << std::endl;
return 0;
} HTH!
|
|
|
|
|
Seriously though, how can three different DLLs export functions with the same exact name? Please tell me you are not the author of those DLLs. If you are, you need to fix it there and not where you consume it.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Seriously though, how can three different DLLs export functions with the same exact name?
It all depends on the requirements! Seriously - I've got a system that extracts symbol information (variable names, addresses, types etc) from debug information. I support several different flavours of debug information (Microsoft PDB, Dwarf1, STABS) and the parser for each different type of information is contained in a separate plugin DLL. Each of these DLLs exports a routine called GetParsers , which gives you access to each of the (singleton) parsers in the DLL.
Similarly, COM DLLs have a similar structure (DllRegisterServer[^], DllGetClassObject[^]).
So, yeah, it's a valid design pattern - whether or not the OP actually meant to do that is another matter, of course
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: So, yeah, it's a valid design pattern - whether or not the OP actually meant to do that is another matter, of course
Which, I was pretty much worried about. I also doubt that he just needs overloaded functions (and couldn't keep 'em all in one DLL), so he wrote 3 DLLs, but to get stuck while trying to consume it. All are assumptions though.
OT: BTW, I ran into trying to debug a release mode binary and it took me 10 minutes to figure that out. I just happened to remember the conversation we had the other day.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
hi stuart thanks a lot,, i luk in to that,, (its late night here,, im leaving)im quite new so need to cover ur suggestion in detail
hi rajesh, thanks for you too for the reply,
actually the 3 DLLs are the c middleware i got that from the customer, and all three are for different language support, so if i select German, My application ll select the 1st first DLL and its functionality to process the text-contents, if i select the French , then 2nd DLL, if its English then 3rd DLL,. I have no rights to change these DLLs
-regards
aravind
|
|
|
|
|
thanks stuart,,
it really worked the way u suggested,
thanks a lot,
thank you rajesh for responding to the post
-regards
aravind
|
|
|
|
|
In C# you can tell the compiler not to expand escape sequences in string literals by prefixing the string with an @ symbol:-
string test = @"C:\test.jpg";
Is there an equivalent notation to do the same in VC++ ? (2008)
thanks
Jon
|
|
|
|
|
use double backslash like "C:\\test.jpg"
|
|
|
|
|
You can do it the hard way.
char test[] = { 'C', ':', 92, 't', 'e', 's', 't', '.', 'j', 'p', 'g', 0 };
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|