|
Thanks for replay, but when I use multi-byte instead of unicode character set I get numerous identical error :
'error LNK2001: unresolved external symbol __iob' in file: 'mysqlclient.lib'
?
edit:
is there a solution for my first post whiteout changing the character set?
Thanks
|
|
|
|
|
You may declare a TCHAR (instead of char ) array. But then you'll probably have to convert also many other pieces of code to make your application 'generic text mappings'[^] compliant.
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
|
|
|
|
|
josip cagalj wrote: cannot convert parameter 1 from 'char [256]' to 'LPCTSTR' ???
Help converting char[256] to LPCTSTR
if you could convert/add new something in your application, try changing occurence of char to TCHAR, which could handle string in generic way, you might have to change some string manipulation function also.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
After using TCHAR Buf[256] instead of char Buf[256] I get error with sprintf(Buf,"%s",...) saying "cannot convert parameter 1 from TCHAR [256] to char*"
|
|
|
|
|
When using generic Text Data type, use Generic Text Mapping routines,
use _stprintf in place of sprintf
|
|
|
|
|
I used 'wprintf' adn it worked (no errors reported). Can I use this?
When I used '_stprintf' like this:
_stprintf(Buf,"%s",cur[off]);, or
_stprintf(Buf, "");
I get error saying "cannot convert parameter 2 from const char[3] to wchar_t"!
|
|
|
|
|
Why don't you spend some time in reading the article whose link is already provide to you by cederic moonen. use _T() macro to map constant strings. ( e.g. _T("%s"))
|
|
|
|
|
josip cagalj wrote: I used 'wprintf' adn it worked (no errors reported).
Here is a perfect chance to learn something - the difference between "works" and "correct".
Please, spend some time learning about Unicode/ANSI/MBCS and how the character-mapping macros work.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Helo , I have one buffer
const char *buff.
Now I want to send this buffer to one of the library function(wodTelnetDLX lib)
which takes const VARIANt &data as its argument.here data is A Variant value. Data to be sent, anything of these types: Boolean, Integer, Long, String, Byte array.
Now when i say
const char *buff;
obj.send(buff);
thne it will give me the following error.
error C2664: 'Send' : cannot convert parameter 1 from 'const char *' to 'const struct tagVARIANT &'
How do i remove this error.
Regards,
Amit
|
|
|
|
|
amit_pansuria wrote: How do i remove this error.
For now, temporarily, you could remove the error by returning a const variant& instead of a const char*
But, your compiler may issue many such errors daily, and if you need to remove all of those errors permanently, you should read a good book on 'C'.
So, why in the hell is it downvoted?!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
modified on Monday, May 5, 2008 6:35 AM
|
|
|
|
|
You have to build properly a VARIANT variable to pass as argument. It depends both on you buffer content and on the library itself (check out the library documentation).
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
|
|
|
|
|
jsut look at library reference of COleVariant Class or you could change you code like this :-
amit_pansuria wrote: const char *buff;
obj.send(buff);
const char *buff = "Something";
COleVariant vtBuff(buff);
obj.send(vtBuff);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Helo thx for replying me.
now suppose I want to do reverse then what i have to do.
const char *buff = "Something";
COleVariant vtBuff(buff);
obj.send(vtBuff);
I mean whe ni received data in form of vtbuff then how i convert vtbuff to buff
|
|
|
|
|
first check vtBuff.vt property for VT_BSTR, if that hold true, vtBuff.bstrVal; will contain the string in BSTR format, you haev to convert that into ansi string urself
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
thx very much. but can i tell me how to write it
.
Regards,
Amit
|
|
|
|
|
amit_pansuria wrote: thx very much. but can i tell me how to write it
i didn't understand what you intended to say??
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
I wan tto say that if i get received data in form of vtbuf then how i convert it into byte
amit
|
|
|
|
|
Does Google not work in your neighborhood? Everything that has been shown to you can easily be searched for.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ya its true.
Now I have one problem if i use
const char *p = buf;
COleVariant vtbuf(buf);
cTelnetDLX.Send(vtbuf); /lib functions It sends data to server.
suppose i want to know that how much data i have send then how can i know
i mean how can i find len from the above functions.
I think I need to use MultiByteToWideChar()instread of using COleVariant vtbuf(buf);
can u tell me how i sue it.
Anyway my received data functions is like this:/
VARIANT var2;
var2.vt = VT_I2;
var2.iVal = VT_BSTR;
var2 = cTelnetDLX.Receive(var, var2);
if (var2.vt == VT_BSTR)
{
// something arrived
// let's dump it to screen
int nLen = WideCharToMultiByte(CP_ACP, 0, var2.bstrVal, -1 ,0,0 , NULL, NULL);
if (nLen>0)
{
char *buff = (char *)malloc(nLen+1);
memset(buff, 0, nLen+1);
WideCharToMultiByte(CP_ACP, 0, var2.bstrVal, -1 ,buff,nLen , NULL, NULL);
SysFreeString(var2.bstrVal);
printf(buff);
free(buff);
}
}
}
}
now tell me how i write send ( I mean reverse MultiByteToWideChar.so that i can find Len
Regards,
Amit
|
|
|
|
|
amit_pansuria wrote: suppose i want to know that how much data i have send then how can i know
i mean how can i find len from the above functions.
If you are using BSTR and VARIANT objects, check out _bstr_t::length() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Suppose in a project there are two file abc.cpp and 123.cpp
In abc.cpp i did following
ofstream myfile;
myfile.open (path.c_str(), fstream::app);
I want to write data onto this file from 123.cpp program.
How Do I do that. Please help me out.
Thanks
|
|
|
|
|
pl_kode wrote: I want to write data onto this file from 123.cpp program.
You need to open the file from the program, which needs to write data to the file.
Probably I am missing something. There shouldn't be such an easy question though.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: Probably I am missing something
Probably he did.
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
|
|
|
|
|
CPallini wrote: Probably he did.
humm detective
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi,
Make "myfile" global. then in your 123.cpp file declare it as extern.
like
extern ofstream myfile;
thanks,
Nitheesh
|
|
|
|