|
Hi all,
I have any string in given format:: "string1-string2 string3"
i want to fetch string1 that is comes before sign "-",so please tell me how can i do this?
is solve when i use findstring function.
please help me.
if possible please explain with example.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
CString::Tokenize
CAtlString str( "%First Second#Third" );
CAtlString resToken;
int curPos= 0;
resToken= str.Tokenize("% #",curPos);
while (resToken != "")
{
printf("Resulting token: %s\n", resToken);
resToken= str.Tokenize("% #",curPos);
};
By the way don't you have MSDN installed?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: By the way don't you have MSDN installed?
why installed ?
it is online, and I doubt the poster writes here by telepathy...
|
|
|
|
|
The MSDN site may be blocked LOL
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
If you're not using a string class, there's always _tcstok()
|
|
|
|
|
or sscanf() ... He did say the string always had the exact same format ...
|
|
|
|
|
Hello everyone,
In the MSDN document for uuid, it is mentioned "The compiler attaches a GUID to a class or structure declared or defined (full COM object definitions only) with the uuid attribute.". I am very confused about this statement, the input is a string format of GUID -- it is clear, but my question is what is the output and what means "attach" here?
thanks in advance,
George
|
|
|
|
|
Every COM object needs to be identified uniquely on a machine. For this the compiler generates a UUID (Universally Unique Identier) to distinguish one interface from another.
For eg: how would the system identify the uniqueness of IUnknown. For this it binds a structure having the GUID with IUnknown
[
uuid(ba209999-0c6c-11d2-97cf-00c04f8eea45),
version(1.0)
]
interface INTERFACENAME
{
}
so if you have an interface call IMyIUnknown replace IMyIUnknown with INTERFACENAME and now this interface has a attached UUID with it so that it can be uniquely identified.
Hope I helped...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks AnShUmAn,
I think uuid is used to uniquely identifies an interface or coclass, but I am quite confused why you give an interface name replace sample here? Does uuid have some special usage in the situation of interface name replacement?
regards,
George
|
|
|
|
|
This is specific to MS and COM, it is not general C++.
By 'attach' they mean the compiler generates the COM specific code needed to associate the generated uuid with the class as a type.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Thanks cmk,
cmk wrote: By 'attach' they mean the compiler generates the COM specific code needed to associate the generated uuid with the class as a type.
Could you provide more information about what do you mean the generated code which does the association please?
regards,
George
|
|
|
|
|
Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get:
cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)'
(Im new to C++)
Y*Live Long And Prosper*Y
|
|
|
|
|
False Chicken wrote: Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get:
cannot convert `std::basic_string<char,>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)'
This way!
string StrSysCommand = "cls";
system( StrSysCommand.c_str() );
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
False Chicken wrote: Im new to C++
that doesn't forbids you to interrogate the documentation...
the std::string class (which is a specialization of the std::basic_string template class) has a c_str()[^] member function...
|
|
|
|
|
I have created a dialog to display message on my application for 5 seconds after which the dialog closes. I created the dialog using the following code before which I update the display message text for the dialog
sDispMsg = (CString)"Setting up the Design Condition";
CProgressDlg pProg;
pProg.DoModal();
The above code is within a function. When I call the function it works fine. But when I call the above function after creating a thread using the code:
if( bAteRunThreadActive == FALSE )
{
htAteRunThread = CreateThread( NULL,0,(LPTHREAD_START_ROUTINE)tExecuteAte,(LPVOID)NULL,NULL,&dwAteRunThreadID );
if( dwAteRunThreadID == NULL )
{
AfxMessageBox( "ATE Thread Creation Failed" );
return;
}
bAteRunThreadActive = TRUE;
}
Note that when I am creating the dialog inside the thread function, my application crashes at the point after I call the Settimer in the below code. When I call normally outside the thread in a normal function it works fine. Also when I did a step by step debugging it works fine in the thread function also.
Pls provide some solution.
//My Dialog code
BOOL CProgressDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
GetDlgItem(IDC_STATIC_DISPMSG)->SetWindowText(sDispMsg);
tID = SetTimer(1,5000, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CProgressDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
/* int nRet = 5; */
KillTimer(tID);
//EndDialog(0);
CDialog::OnCancel();
// DestroyWindow();
// AfxGetMainWnd()->UpdateWindow();
//CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
Whow, you've managed to make a lot of conceptional errors.
Perhaps you don't need a secondary thread at all.
If you would create a modeless dialogue instead of a modal one, you would be able to continue doing what you should in one single thread.
But if you think that you do need a secondary thread, you'd better read this[^] before you continue. In your case it's essential that you do read the article.
Main issues are:
- don't do GUI stuff from a worker thread
- SetTimer is considered GUI stuff since it is a member of CWnd
- If it was not out-commented, AfxGetMainWnd() would return NULL
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
Hi all,
I have made a sdi application, in which i have made several ui threads...
Now, i want to debug my program..
how should i debug it...
Thanks in advance
|
|
|
|
|
Just Googled [^] and Found this[^]
What the exact kind of UI/Application problem you're going to resolve?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
break points , message boxes , log files that what I do
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
|
When I run a VC++8.0 Project I got a dialog box which states "The application failed to initialize properly(0xc0150002). Click on OK to terminate the application.". If I terminate the application, the following message is displayed in the output Window:
LDR: LdrpWalkImportDescriptor() failed to probe C:\Program Files\Delta3D_REL-2.0.0\bin\dtUtild.dll for its manifest, ntstatus 0xc0150002
How to resolve the error?
Note:
This error occurs only under Debug mode.
modified on Friday, September 5, 2008 7:29 AM
|
|
|
|
|
T.RATHA KRISHNAN wrote: How to resolve the error?
wait, you're compiling your project in debug mode, aren't you ?
compile in release mode, and see if it's better. The Release Mode should be linked to dtUtil.dll (not dtUtild.dll).
|
|
|
|
|
clean the output directory and recompile the full project .
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|