|
im 15 years old,Im iranian.im learning c programming.
i wanted to ask you how can i use for and while.
if you can please make me an example and describe all.
thanks
my mail is khodadad@eminem.com
im waiting you.
thanks
khodadad pakdaman
khodadad@eminem.com
|
|
|
|
|
See this article:
http://howstuffworks.lycoszone.com/c3.htm
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
kh.pakdaman wrote:
im 15 years old,Im iranian
then why is your profile set to "United States"?
Don't try it, just do it!
|
|
|
|
|
Possibly for the same reason that in the room I'm sat in, we have German and French/Portuguese developers, although we're physically located in the United Kingdom...
Nationality is generally determined by birth/statute, rather than by current location, otherwise I'd have been Jamaican for five weeks...
Steve S
|
|
|
|
|
Hi,
I have got a CDialog instance, and it has a Cancel and an OK button, OnOk works, but if I call OnCancel, or EndDialog(x), I'm getting an error (in runtime:mad). It says this:
Debug Assertion Failed!
file: wincore.cpp
line: 4184
Can this be caused by the fact that I've got another CDialog instance wich calls the DoModal of the one above? Please help me solve this problem!
|
|
|
|
|
Its not possible to figure out what cud be the issue with the above description.
Would like to know from where that dialog created, what happens after the dialog is dismissed, et al.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
You can also check the CallStack by running the program in DEBUG mode, and see from where it got to Wincore.cpp
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
OK,
If I simplify the situation the following happes:
diag2 : diag2.DoModal
diag2 : do some work etc...
diag2 : when ready (or user presses cancel) EndDialog()
or
diag2 : when ready (or user presses cancel) OnCancel()
|
|
|
|
|
Is it like this ??
In Dlgdiag2.cpp
CDlgdiag2::OnSomeAction()
{
CDlgdiag2 diag2;
diag2.DoModal();
}
CDlgDiag2::OnCancel()
{
EndDialog();
OR
OnCancel();
}
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Jagadeesh VN wrote:
CDlgdiag2::OnSomeAction()
{
CDlgdiag2 diag2;
diag2.DoModal();
}
CDlgDiag2::OnCancel()
{
EndDialog();
OR
OnCancel();
It is:
CDlgdiag1::OnSomeAction()
{
CDlgdiag2 diag2;
diag2.DoModal();
}
CDlgDiag2::OnCancel()
{
EndDialog();
OR
OnCancel();
}
|
|
|
|
|
If you are calling OnCancel(), you are in trouble. It will take you to an infinite loop. So you should be using CDialog::OnCancel()
I know, thats not the problem you are facing. But apart from that, I just can't find anything odd in this piece of code. You can do one thing. As I have suggested earlier put a breakpoint in
CDlgDiag2::OnCancel()
{
EndDialog(); //HERE
}
put another break point in
CDlgdiag1::OnSomeAction()
{
CDlgdiag2 diag2;
diag2.DoModal();
} // HERE
run the program in DEBUG mode( press F5 ), and then press the Cancel button, then you will be in EndDialog fn. press F5 again, then either the control will reach the 2nd break point, or else it will ASSERT. When it ASSERTs, right click anywhere on the toolbar and select the 'CallStack' option. If you are not getting any idea on what it is, just dump it here, so that we can have a look at where its going wrong.
Another thing I noticed is, wincore.cpp has only 3948 lines. How come you got an error in 4198 ?
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
If possible, post the code.
OR
you can use CallStack( Right click anywhere on the toolbar, and select CallStack ) in debug mode to see how the control reached wincore
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
BoudewijnEctor wrote:
file: wincore.cpp
line: 4184
Strange as wincore.cpp does not have that many lines. Are you using VS6 or VS.NET?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I was also little bit confused!!!
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
I've got a listBox in a program, and an array of instances of an own class. This class has a property called ID, and name. Both can be accessed by using get_ID(), and get_name(). The user must be able to select an instance in the listbox by selcting its name and clicking a button.
This works, I use getCurSel, as long as I know what position each instance has in the list. But other people will need to add their own instances, and they will have to change all the ID's etc.
Is there a way to determine the text selected in a list box, instead of the position of the selection, so I will know exactly which instance is selected?
Thanks,
|
|
|
|
|
The way that I use is when I add a string to the list box, I also setup a pointer to the custom data, in your case, your own class. I usually do this with:
m_ListBox.SetItemDataPtr (m_ListBox.AddString (item->name), (void *)item);
You can then get the item data for the current selection like so:
my_class *item = (my_class *)m_ListBox.GetItemDataPtr (m_ListBox.GetCurSel ());
Does this help?
www.originalsinsoftware.com
|
|
|
|
|
You can use the CListBox::GetText method. GetText accepts the position and LPSTR as input, and you can pass the selected item position, and get the corresponding text.
pListBox->GetText( position, str.GetBuffer(MAX_LENGTH) );
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Is DirectX available to .NET framework? If not, is there any plan to make it available yet?
norm
|
|
|
|
|
Yes it is available... rather I programmed some programs in C#... You can download DirectX SDK from Microsoft.com
DirectX 9.0 Software Development Kit (SDK) for C#
http://download.microsoft.com/download/9/9/3/993dbaf4-3327-4f77-9bcb-9b6a6235170b/dx90_sdkcs.exe
mE
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
hey, that's very nice to know. Would you recommend a book? Or is the documentation sufficient?
norm
|
|
|
|
|
Hi
Can someone know a library wich is used to convert hexadecimal numbers to integers (I know how to do this, but I don't have time to wirte it myself). I just need an open-source function.
Thanks
|
|
|
|
|
BoudewijnEctor wrote:
convert hexadecimal numbers to integers
I think you might mean hexadecimal strings to a number.
The C++ library function, strtol() will do the job for you.
Or _tcstol() for the UNICODE compatible function.
long wcstol( const wchar_t *nptr, wchar_t **endptr, int base );
You just need to specify the base, in your case this would be 16.
I Dream of Absolute Zero
|
|
|
|
|
the question is kinda bad!
what do u need the conversion for?
hexadecimal to (int)string or what?
Don't try it, just do it!
|
|
|
|
|
Hi currently i use MSComm32.ocx control i just try to pass data into comm port ,i open port and send data by using
mptr->PutOutput("text"); simple text all fine not any error
arised.But when i try to pass binary data this way
byte bt[] = {1,2,3};
VARIANT vt;
vt.vt = VT_BYREF | VT_UI1;
vt.pbVal = bt;
mptr->PutOutput(vt);
Run time error hr = -2146827908 (Unknown error)!!!
I guess this trouble arised because of i unproperly created vt variable.
And by the way how i can properly create any pointers in variant type??? I think
first step is create array with neccesary values
byte bt[] = {1,2,3};
,second step copy this array to variant union
vt.pbVal = bt;
and third step defint through vt member of VARIANT this type
vt.vt = VT_BYREF | VT_UI1;
Its enought???
How compiler recognized how much ellements on array into passed VARIANT structure???This only pointers and one cant do it i thought???
Sorry for bad Eanglish.
|
|
|
|
|
Guys,
I've created a dockable tool bar. By default on the top of dockable tool-bar, there is a caption bar with close button. I like to remove this caption bar and close button from my tool bar. How can i do so
|
|
|
|