|
Hi CPallini,
I redo the test, you are correct, the more \r\n the file has, the more size is reduced.
I did the test by a txt file, if I change file extension of the txt file to any others, i.e. kbc, file-size is not changed.
wonderful.
|
|
|
|
|
You should not rely on file extension. Instead use binary mode to transfer files.
-Saurabh
|
|
|
|
|
Needed that Visual studio pause the application and tells me a message when an infinite number or a NAN is generated so I can debug and remove the causes.
Any flag available on the solution's properties?
Thanks
Russell
|
|
|
|
|
You can put a breakpoint and set the breakpoint condition as something that check the value. Then start debug run. VS will break the execution once the condition is met.
Btw, I don't think that there is a specific condition check like NAN or infinite (in C/C++). But you can check the range of value depending on the variable type.
For example,
long n can be checked something like ( (unsigned long) n > 0x7FFFFFFF ).
- ns ami -
modified on Tuesday, September 29, 2009 11:19 PM
|
|
|
|
|
In that cases I think it is possible to use functions like isnan() and isinf().
Other test like you wrote probably will fail because you can't use standard math in that cases.
But the problem is that I have to find when and where the problem happens to set some addictional line to let the algorithm be safer. So I can't check every single line with breakpoints (only the lines of the algorithm that I'm testing are more than 10000 and on different files).
It is surely needed an help from the debugger, it have to check for us and open a dialog like happens for ASSERTs so we can work.
It looks strange that there isn't any option that can be set into the debugger...
Russell
|
|
|
|
|
Russell' wrote: only the lines of the algorithm that I'm testing are more than 10000 and on different files
Sounds like a very complicated algorithm!
Russell' wrote: It looks strange that there isn't any option that can be set into the debugger
Well if the program doesn't signal anything on these errors how is the debugger supposed to recognise it, apart from checking the results of every instruction in the program. Consider how long that may take to run.
|
|
|
|
|
It doesn't matter how long it will take: this is simply an advanced-debug step, the release version will not contain this big amount of addictional operation.
... and without this help we surely will lost more and more time going to check all the code
Also because this algorithm works for some set of data, but dont' works for other sets (probably because for some reasons the numbers becames too small).
Russell
|
|
|
|
|
Nishad S wrote: long n can be checked something like ( n > 0x7FFFFFFF ).
How? If you add 1 to that value, it becomes negative, thus failing the test.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Yes. I have updated my reply.
((unsigned long) n > 0x7FFFFFFF)
- ns ami -
|
|
|
|
|
I have not tried this.
According to the docs[^] you can use _controlfp() to unmask floating point exceptions, which are all masked by default, by specifying the _MCW_EM mask.
Also maybe check out _fpieee_flt()[^] and _fpclass()[^]
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
It looks exactly the type of tip that I was looking for!
I'll let you know if it is the right way after some tests.
Thank you
Russell
|
|
|
|
|
Russell' wrote: I'll let you know if it is the right way after some tests.
Just wondering if it worked for you or not.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
in addition to _fpclass there are _isnan and _finite.
A class wrapping up _fpclass is probably the way to go.
|
|
|
|
|
I need to load 36 jpg images from a folder and display them in a GUI one by one. each image is going to be displayed for 1 second. i also need to develop it by using MFC dialog.
the main problem i have now is that i don't know how to display jpg images in a dialog. i think i should use picture control in the dialog. but it only supports bitmap format.
anyone can help?
|
|
|
|
|
load the pics at startup one time and holds them and draw when approbiate. Draw in a overriden OnPaint() method.
Geart code:
CxImage[^]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Have a look at CImage[^] (it loads jpg files)
Max.
This signature was proudly tested on animals.
|
|
|
|
|
I have come across this in the past and the only way I have found is to use the OleLoadPicture() function. There is an article here[^] on Code Project with some more information that may explain things.
|
|
|
|
|
You don't need CImage or any lib.
JPG is native in Win32 Shell (8 native methods to load them..)
|
|
|
|
|
kilt wrote: JPG is native in Win32 Shell (8 native methods to load them..)
Quote Selected Text
Sorry, I don't understand what you mean by Win32 Shell in this context. Can you show me these methods and where they are in the MSDN documentation?
|
|
|
|
|
Hi,
When coding an initializer list for a base contructer e.g.
using the example below
where does c " int c " have to be declared somewhere in derived class "a" ???
Class a : public b
a() : b(int c)
thankx
|
|
|
|
|
Do you mean something similar to:
class B
{
int _b;
public:
B(int b):_b(b){}
};
class A: public B
{
public:
A(int c):B(c){}
};
void main()
{
A a(7);
} ?
What's your trouble about?
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
[My articles]
|
|
|
|
|
If you want to initialize member variables of class b , you'd need something like:
class b
{
int num;
public:
b( int n )
{
num = n;
}
};
class a : public b
{
public:
a( int c ) : b(c)
{
}
};
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
In other words it has to be in the derived
class constructer paramter list BTW can
I pass "this" pointer in the derived class
paramter list e.g. a(this) : b(this)
Thankx
|
|
|
|
|
please look into the below code block.
HBRUSH CTestApplnDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int nId = pWnd->GetDlgCtrlID();
CString sData;
if (nCtlColor==CTLCOLOR_EDIT)
{
switch(nId)
{
case IDC_EDIT1:
{
m_EditCtrl.FmtLines(FALSE);
m_EditCtrl.GetWindowText( sData );
}
break;
default:
break;
}
}
return hbr;
}
The m_EditCtrl.FmtLines(FALSE) causes crash in my application.
Please help me to sove this problem.
|
|
|
|
|
KASR1 wrote: The m_EditCtrl.FmtLines(FALSE) causes crash in my application.
What is a "crash?" Is an exception thrown? Was an assertion fired? Have you used the debugger to verify that the edit control exists yet? If you comment that line, does the "crash" still occur (on the next line, perhaps)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|