|
Hamid. wrote: And I think Displaying split Bitmap files[^] is helpful for you.
How?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I saw your answer was perfect so I guess maybe this article is helpfuls for "_$h@nky_" on the othe aspects.
|
|
|
|
|
that's nice article. who downvoted you.. let me clear the air!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Enemy!
|
|
|
|
|
let's kill them then
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
|
Hi all,
i have done little calculation.
ULONGLONG test;
long double final;
test=test+1024;
final=test/1048576;
here if the actual value of final thru debugging is 7.260000, but it show only 7.00000000;
please tell me how can i get exact value
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
|
|
|
|
|
It looks to me (though I could be wrong) like this is a problem with an implicit cast. What the compiler is doing is this :
final = (long double)(test/1048576);
but what you actually want it to do is this :
final = ((long double)test)/1048576;
Give it a try. Hope that helps.
|
|
|
|
|
That won't solve the problem neither: you are still dividing by an integer (1048576), so the result will be an integer.
EDIT: oooops, I don't know what I smoke this morning but I am completely wrong. Once one of the operand is a double, the result will be a double too. The problem occurs once both operands are integers, then the result will be an integer too. So, casting one operand to a double as you did correct the problem.
modified on Monday, August 18, 2008 8:19 AM
|
|
|
|
|
The problem is because you are dividing by an integer. Thus, the compiler will implicitely cast your double into an integer in order to make an integer division (thus, the result will be an integer).Try this:
test = test + 1024.0;
final = test/1048576.0;
EDIT: as I explained here[^], I was not very awake this morning . So, once you have at least one double in the operands, then the result will be a double too. If both operands are integers, then the result is an integer too.
modified on Monday, August 18, 2008 8:23 AM
|
|
|
|
|
test is an integer so there's no benefit to adding a floating point
const to it.
What's important is coercing the integers to doubles before performing
the division
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: test is an integer so there's no benefit to adding a floating point
const to it.
Yes sure. But if you see my other post, you can see that I was wondering what I smoked this morning
|
|
|
|
|
I wonder that often myself (what you smoked this morning)
(kidding, of course)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
C language tutorial needed.
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
[Image resize DLL]
|
|
|
|
|
Hi gray friend before this post.
|
|
|
|
|
The floating-point library has not been initialized. Simply divide by 1048576.0 instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
I need some algorithm to store and retrieve the image in file. I Load the image by using Load function in CImage class. Now i want to store the image in a .txt file and again user need to read that file and display the image in the screen.
Please you have any idea send me...
With Regards.
Bernaad....
|
|
|
|
|
Bernaad wrote: Now i want to store the image in a .txt file
What ? You want to save your image in a text file ? Can you explain what you are trying to do, because it doesn't make a lot of sense to me...
|
|
|
|
|
Generally i want to store the image, image size and its extension in a file(it may be any file type) when user click save option in the menu. when he want to display that image after some time, he can get the image by read that file and display that image in the screen.
I use Load() to load the image using CImage Class.
|
|
|
|
|
It's still not clear for me what you should do with this file. So, you have a button on which the user can click on and you want to save the image with some properties in a file.
Bernaad wrote: when he want to display that image after some time, he can get the image by read that file and display that image in the screen.
That's the part I don't get. This file will only be opened by your program right ? So why do you have to make things complicated like that ? Why don't you simply save the image directly and then retrieve those properties later when the user wants to disaply the file. It will avoid you to make your own complex file type with duplicate informations that are already contained in the original file.
|
|
|
|
|
Bernaad wrote: Now i want to store the image in a .txt file
Please elaborate (you're walking on the edge of the nonsense).
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
[Image resize DLL]
|
|
|
|
|
CPallini wrote: you're walking on the edge of the nonsense
Looks like the holiday worked. It has added more to your sense of humor.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
THHB back again!
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
[Image resize DLL]
|
|
|
|
|
or there was a very powerful troll here [^], since first vote was a five.
BTW: nowdays people don't appreciate the power of the tutorials...
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
[Image resize DLL]
|
|
|
|
|
No worries - adjusted.
*some people just don't like tutorials*
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|