Hello i am using visual studio 2013 on a windows 7 64 bit. I am trying to build a huffman tree, i have actually built it but i have problems when i try to use cyrllic i manage to get to this situation
All that is left to do is use AnsiToOem() but i get the cannot convert from 'const char *' to 'LPCTSTR', i know that LPCTSTR is a windows 4 byte, so my question is there a way ?
2. LPCTSTR is actually a typedef of either constwchar_t* (if you're project in configured to build for the Unicode Character Set) or constchar* (if configured for the Multi-Byte Character Set or default.)
Likewise, AnsiToOem() is actually a pre-processor macro than ends up evaluating to either AnsiToOemA() (for ANSI builds) or AnsiToOemW() (for Unicode builds.)
Your problem will be solved if you used AnsiToOemA() rather than AnsiToOem().
Error 1 error C2664: 'BOOL CharToOemA(LPCSTR,LPSTR)' : cannot convert argument 1 from 'byte [18]' to 'LPCSTR' c:\users\user\documents\visual studio 2013\projects\test11\test11\source.cpp 43 1 test11
2 IntelliSense: argument of type "byte *" is incompatible with parameter of type "LPCSTR" c:\Users\user\Documents\Visual Studio 2013\Projects\test11\test11\Source.cpp 43 12 test11
3 IntelliSense: argument of type "byte *" is incompatible with parameter of type "LPSTR" c:\Users\user\Documents\Visual Studio 2013\Projects\test11\test11\Source.cpp 43 18 test11
As I can see from your earlier post, text is a buffer of unsigned chars. This cannot be passed to a function expecting a (signed) char* without casting, as you are already doing when calling strlen().
You could do the same thing when calling AnsiToOem (without the const), but do you actually need text to be unsigned chars? The "helpful" example you post is using char rather than unsigned char.
Andy
PS Working with Unicode or even UTF-8 strings might be better than using OemToChar (as OemToAnsi is now called.)
Yes i am heading to that direction using Unicode or UTF-8, ANSI is just making things more complex, i just have to do some recoding and they i will post the result hope it gets something out..