|
Thanks for clarifying what I said! I think I need to stop and go to bed.
|
|
|
|
|
Thanks, I appreciate your responses.
|
|
|
|
|
I would like to know that how to add onTimer in .NET as in VS6.0 with ClassWizard?
Please help!
|
|
|
|
|
Thank you everybody!
I solve the problem now!
|
|
|
|
|
LaHaHa wrote: Thank you everybody!
You're welcome!
|
|
|
|
|
#include <string.h><br />
#include <stdio.h><br />
<br />
char string[] = "A string\tof ,,tokens\nand some more tokens";<br />
char seps[] = " ,\t\n";<br />
char *token;<br />
<br />
void main( void )<br />
{<br />
printf( "%s\n\nTokens:\n", string );<br />
<br />
token = strtok( string, seps );<br />
while( token != NULL )<br />
{<br />
<br />
printf( " %s\n", token );<br />
<br />
token = strtok( NULL, seps );<br />
}<br />
}<br />
that is straight from msdn it does what i need but
char string[] = "A string\tof ,,tokens\nand some more tokens";
i need that line to take the text from a edit box in the form of a CString and i dont know how to do it.
|
|
|
|
|
The EditBox has a GetWindowText method, which returns a CString. CString has a GetBuffer method that you can use to get a char *, which is the same as a char[].
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
error C2440: 'initializing' : cannot convert from 'char *' to 'char []
this is new to me.
|
|
|
|
|
I'd expect a cast to fix that.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
you lost me there i can do simple things i dont even know what a cast is.
|
|
|
|
|
i think i got it
char *text = m_text.GetBuffer(m_len);
strcpy( text, m_text ); // directly access CString buffer
m_text.ReleaseBuffer( ); <--- added them 3 lines
//char string[] = text; <--- took that line out
|
|
|
|
|
Yes, this copies it across. A cast would be passing text like this:
(char[]) text
A cast changes the type of an object, assuming the cast is valid.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
i need the conversion from binary to decimal and vice versa but in a very simple way without using libraries
jad
|
|
|
|
|
Binary and decimal are rendering details. The actual values are the same. PErhaps you need to explain what you want to do ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
the program asks the user to input a positive integer and converts it to binary and output the result.
Or the program asks the user to input a binary number and conerts it to decimal and output the result.
this is an example i donno if its right:
#include <iostream.h>
int main()
{
int i;
long int binary;
int decimal = 0;
cout << "Please enter a 8-bit binary number" << endl;
cin>> binary;
for(i = 0; i < 8; i++)
{
if(binary % 10)
{
decimal += 1 << i;
}
binary /= 10;
}
cout << "Your number in decimal is: " << decimal <
|
|
|
|
|
Oh, I see. If you run windows calculator, you can set it in scientific mode, and then it will swap between decimal and binary so you can check your results. Yes, at first glance, this looks right.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
and whats the code from decimal to binary?
jadov
|
|
|
|
|
Well, try reversing the process you have now.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
some body would show me how to split windows( Views ) in a MDI application?
I used to via add a new CMultiDocTemplate object int the InitInstance function. Then ,when the application runs,a small dialog would appear first,which force me to select a view(i thinks it means so).
But i want to show a different splited window by responding to a menu instead of the selecting at first of the program.
Someone would help me,Thanks.
|
|
|
|
|
Dear folks,
We have a perfectly good FP error handler on VC7.1, VC8 and so on. However, none of the stack is visible if we set a breakpoint inside the FP handler. So basically we have no idea where the offending code is that is causing the FP error to fire. Any ideas on how to get a usable stack inside (or outside) the debugger?
An example of the stack:
> MyProgram.exe!IeeeFPHandler(_FPIEEE_RECORD * pieee=0x0012ec10)
Line 168 C++
msvcr71.dll!7c3744fa()
ntdll.dll!7c90e21f()
kernel32.dll!7c80b9bd()
kernel32.dll!7c80b9e6()
msvcr71.dll!7c34d518()
MyProgram.exe!FPEGuardedExecution(int (void *)* func=0x0012fe20,
void * d=0x0012edd4) Line 214 + 0x1d C++
ntdll.dll!7c9037bf()
ntdll.dll!7c90378b()
ntdll.dll!7c937860()
ntdll.dll!7c91b686()
and our handler
#ifdef _WIN32
#include <excpt.h>
#include <float.h>
#include <fpieee.h>
static int fpWarningCount = 0;
static int
IeeeFPHandler( _FPIEEE_RECORD *pieee )
{
string s = "Unhandled floating point error";
if (pieee->Cause.InvalidOperation) {
s = "Invalid floating point operation";
}
if (pieee->Cause.ZeroDivide) {
s = "Floating point zero divide";
}
if (pieee->Cause.Overflow) {
s = "Floating point overflow";
}
if (pieee->Cause.Inexact) {
s = "Floating point Inexact";
}
if (fpWarningCount == 8)
s += "\nSuppressing further floating point errors";
if (fpWarningCount <= 8)
MessageDlg::critical(I18n(s));
fpWarningCount++;
return EXCEPTION_CONTINUE_EXECUTION;
}
|
|
|
|
|
Hello,
I have a application where I need to write a lot of labels and data to a window. The labels and data are located on the window using X, Y coordiates.
It would be easier not to use controls I think, since labels and data need to be placed dynamically on the dialog window, and there is a lot of data. I think it would be easier to write to the window much like a dos window.
Question:
At this point I have created a simple dialog window, but wish to write to it as indicated above using X, Y coordiates. How do I do this?
Jerry
|
|
|
|
|
jerry1211a wrote: How do I do this?
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
jerry1211a wrote: I think it would be easier to write to the window much like a dos window
I don't know if that's a good idea (perhaps you can use a list view...), anyway, you have to override the OnPaint handler, calling the TextOut method of the supplied device context.
hope that helps...
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.
|
|
|
|
|
I want to print as a text a White happy face. On MSWord if you press Alt+ numerical 1 you will get White happy face. Please note that it is non-printable character, but as MsWord and other editors are doing, I do not know the trick. It looks to me it must have some WCHAR code to print it. Any idea?
Agha Khan
|
|
|
|
|
It's the WingDings font, I believe.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|