|
|
Hi,
How can I advance the sscanf statement to read each word in the sentence? Right now my output is an endless loop of "This".
CString incoming_line="This is my example incoming line.";
CString string_out;
while (sscanf(incoming_line, "%s", string_out )==1)
{
cout<<string_out<<endl;
}
Thanks!
|
|
|
|
|
you could do something like this:
int offset = 0;
while (sscanf(incoming_line + offset, "%s", string_out )==1)
{
cout<<string_out<<endl;
offset += strlen(string_out);
}
|
|
|
|
|
Chris,
Thanks for your help.
I'm getting the following error when I use your suggestion.
Error 2 error C2666: 'ATL::CStringT<BaseType,StringTraits>::operator +' : 3 overloads have similar conversions
Any ideas?
Thanks,
|
|
|
|
|
oops. didn't see the CString there.
|
|
|
|
|
b-rad311 wrote: while (sscanf(incoming_line, "%s", string_out )==1)
You cannot use a CString object in this capacity.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi David,
Should I use "const char*" instead?
|
|
|
|
|
If you did, then how would scanf() be able to change its contents?
Since you are using MFC, have a look at CStringT::Tokenize() or AfxExtractSubString() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi friend,
How to change static text color and backgroung color, please help me.
Thanks and Regards,
D.Manivelan
|
|
|
|
|
Member 4482742 wrote: How to change static text color and backgroung color...
Are you referring to WM_CTLCOLOR or one of its variants?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I'am hooking the sendto function and i would like to log names of every DLL/prog which call it.
How can i retrieve the names of the DLLs which call to the sendto hooked function ?
|
|
|
|
|
You could insert GetModuleFileName(NULL, ..) into your hook function
virtual void BeHappy() = 0;
|
|
|
|
|
I already made a try with this method but it id not work.
The returned name's module is the one of the *.EXE which loaded the DLL, but not the DLL's name itlsef(DLL which makes calls).
|
|
|
|
|
Call GetModuleFileName() with the HINSTANCE that was passed to your DllMain() function. That said, I do not believe GetModuleFileName() is what you are after.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello
Question : Differentiate static and extern ? If the data is static, how can you access that data in another file ?
My answer is :
The static keyword allows a variable to maintain its value among different function calls. Extern says the variable, or function, is defined outside this source file.
main.h
--------
#include <>
static int x;
main.c
--------
#include "main.h"
int main(void) {
printf("\n x is %d", x);
return 0;
}
My answer is sufficient or partially or wrong ...? Give me an advise ?
Thanking you.
|
|
|
|
|
its partially correct.
'static' has multiple meanings. you've mentioned one, but there is another meaning that is more closely related to 'extern'.
|
|
|
|
|
Could you elaborate it , please?
|
|
|
|
|
|
Hi Created a CRectTracker for a button,it is resizable. i dont want to Resize option but i want click and move the button within the dialog.
CRectTracker(rect,CRectTracker::dottedLine | CRectTracker::hatchedBorder );
CRectTracker::resizeOutside like is there NoResize option
|
|
|
|
|
It would not be resizable,
when you will call its CRectTrcker::Draw(..) only
Just modify CYourDialog::OnPaint() function
virtual void BeHappy() = 0;
|
|
|
|
|
My application has several MFC threads running concurrently; these threads process their messages by using Peek Message.
I want to know queue size in each thread (i.e. pending messages in thread queue).Is there any API that can tell me the message count or pending message count for each thread.?
If there is no such an API, Is there any method to get message count at process level.?
ajmalsiddiqui
|
|
|
|
|
Would GetQueueStatus() help?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks for the response , but i think this would not because this function returns the type of messages in the queue, not message count or queue length.
I wan to get number of messages in queue or number of pending messages in queue.
ajmalsiddiqui
|
|
|
|
|
ajmalsiddiqi wrote: Thanks for the response , but i think this would not because this function returns the type of messages in the queue, not message count or queue length.
It returns the number of the type you request.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As far as I know you shouldn't run into any problems because the queue is too small. It's one of those questions that the very fact it's asked makes me wonder if your design is "correct". Can I ask why you need to know?
Steve
|
|
|
|