|
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
|
|
|
|
|
pl_kode wrote: ofstream myfile;
myfile.open (path.c_str(), fstream::app);
you could take help of singleton pattern, you could write all of your code writing data into the file in singleton class, then call teh object of singleton anywhere from program.
http://www.codeproject.com/KB/cpp/singletonrvs.aspx[^]
"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$$>
|
|
|
|
|
<br />
<br />
BOOL dlgWait::OnInitDialog(void) <br />
{ <br />
CDialog::OnInitDialog(); <br />
<br />
SetTimer(1,500, NULL); <br />
<br />
return TRUE; <br />
} <br />
<br />
void dlgWait::OnTimer(UINT_PTR nIDEvent) <br />
{ <br />
AfxMessageBox("aaaa"); <br />
CDialog::OnTimer(nIDEvent); <br />
} <br />
<br />
dlgWait waitDlg; <br />
waitDlg.Create(IDD_DLG_WAIT,NULL); <br />
waitDlg.ShowWindow(SW_SHOW);
Sleep(10000); <br />
<br />
<br />
<br />
|
|
|
|
|
The problem is because of the Sleep(10000). By doing that, you prevent window messages to be processed, thus your timer message will only be processed after the sleep.
|
|
|
|
|
hanlei0000000009 wrote: waitDlg.ShowWindow(SW_SHOW); // AfxMessageBox("aaaa"); would't display
Sleep(10000);
Sleep (10000); will block message pumping.
|
|
|
|
|
hanlei0000000009 wrote: Sleep(10000);
anyways why you require sleep(10000) here!
"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
I am using this structure and getting the MailPath and Attachment name
/////////////////////////////////////////////////////////////
struct loginInfo
{
ACL_STATUS status;
ACL_STRUCT_INFO *ACL_INFO;
ACL_STRUCT_MBUSERS_MAIL *ACL_STMAIL;
ACL_STRUCT_MBUSERS *ACL_MBUSERS;
// ACL_STRUCT_MBUSERS_INFO ACL_MBUSER_INFO;
};
loginInfo *linfo = (loginInfo*)dummy;
linfo->ACL_INFO=new ACL_STRUCT_INFO;
linfo->ACL_STMAIL=new ACL_STRUCT_MBUSERS_MAIL[MAX_MAIL_COUNT];
linfo->ACL_MBUSERS=new ACL_STRUCT_MBUSERS[MAX_MAILBOX_COUNT];
//////////////////////////////////////////////////////////////////////////
Now i am getting result as
////////////////////////////////////////
printf("Path of the mail is %s\n",linfo->ACL_STMAIL[y].cMBUserMailPath);
printf(,"\n%s Attachment Found\n",linfo->ACL_STMAIL[y].cMBUserMailAttachFile);
///////////////////////////////////////////
OutPut is
///////////////////////
linfo->ACL_STMAIL[y].cMBUserMailPath = "http://test/sharan/inbox/wel.xml"
linfo->ACL_STMAIL[y].cMBUserMailAttachFile)=#Sample.jpg#TSXGMP850_EN_V10.pdf
/////////////////////////////
Requuirement
///////////////////
First i want to get the "#" sign from attachments separate the attachment file
1)Sample.jpg
2)TSXGMP850_EN_V10.pdf
////////////////////
I hope u understood me ..plz help me
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
I prefer tokenize API with delimiter '#' like CString::Tokenize, strtok
|
|
|
|
|
If you're using a plain C approach, then have a look at strtok [^] function.
If you need a more sophisticated tool for parsing strings, consider the Boost.Regex [^].
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
|
|
|
|
|
Hi..
I am having
My code
///////////////////////////////
CString MailPath,strMailPath,Attachment;
MailPath = linfo->ACL_STMAIL[y].cMBUserMailPath;
fprintf(stderr,"\nPath of the mail is %s\n",MailPath);
Attachment = linfo->ACL_STMAIL[y].cMBUserMailAttachFile;
fprintf(stderr,"\n%s Attachment Found\n",Attachment);
getchar();
strMailPath = Attachment.Right(MailPath.Find("#"));
printf("new %s attachment",strMailPath);
getchar();
//////////////////////////////////////
See actually Attachment has
#Sample.jpg#TSXGMP850_EN_V10.pdf
I want to separate sample.jpz in one string
and TSXGMP850_EN_V10.pdf in another string..
i am trying the above code.
plz help me
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
are you looking for job ???
"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$$>
|
|
|
|
|
Some months before i asked him to move those to the profile page if required.
|
|
|
|
|
Rajkumar R wrote: Some months before i asked him to move those to the profile page if required.
what about job site !
"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$$>
|
|
|
|