|
Mark,
Oh I wish it were so simple as an invalidate. I have had debuggers help me in the past, but this issue just gets weirder.
At this point, I have OnSize, OnPaint and OnDraw. They all call GetClientRect to determine what needs to be drawn. Only OnSize tracks correctly. So, I have something seriously wrong in the control, perhaps a misunderstanding between me, the control and it's container.
cg
|
|
|
|
|
I have some code originally developed in VS6. The boss wants it to run under VS2005, and I found some problems with atof(buffer).
Buffer is read from an ASCII file, and in VS6 everything goes fine, but in VS2005 its messed up:
buffer is "409600.0000"
in watch window atof(buffer) shows value of 409600.00000000
BUT when I assign to a double variable:
DOUBLE variable = atof(buffer) I get 101523136.0000000
Any help fixing this would be appreciated.
|
|
|
|
|
hmm...
What do you get with this:
char charbuffer[] = "409600.0000";
double doublefromchar = atof(charbuffer);
wchar_t wcharbuffer[] = L"409600.0000";
double doublefromwchar = _wtof(wcharbuffer);
TCHAR tcharbuffer[] = _T("409600.0000");
double doublefromtchar = _tstof(tcharbuffer);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Compiler did not like TCHAR
Still get the same results.
When looking at atof() and _wtof() in the watch window, the results are both 409600.0000
The double variables both show 101523136.00000000 in the watch window.
So, the atof() and _wtof() functions seem to work correctly, its just that when the values are assigned to the variables, things are getting messed up.
|
|
|
|
|
FoxholeWilly wrote: Compiler did not like TCHAR
#include <tchar.h>
FoxholeWilly wrote: When looking at atof() and _wtof() in the watch window, the results are both 409600.0000
The double variables both show 101523136.00000000 in the watch window.
That doesn't make sense. How do you watch the functions?
I fired up VS 2005 and wrote this:
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <stdio.h>
#include <tchar.h>
#include <math.h>
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
char charbuffer[] = "409600.0000";
double doublefromchar = atof(charbuffer);
wchar_t wcharbuffer[] = L"409600.0000";
double doublefromwchar = _wtof(wcharbuffer);
TCHAR tcharbuffer[] = _T("409600.0000");
double doublefromtchar = _tstof(tcharbuffer);
return 0;
}
I can't reproduce anything you are seeing...you've got something
else going on you're not showing us.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
As Mark suggested it is probably a UNICODE issue (VS2005 by default makes UNICODE builds). Could you please post the relevant code.
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]
|
|
|
|
|
note: frequency represents the real-life typedef where the pertinant variable is declared as double.
char buf[80];
FILE* fp;
double frequency;
....
fgets(buf, 80, fp);
frequency = atof(buf);
....
|
|
|
|
|
My Visual Studio 2005 :
The program
#include <stdio.h>
#include <stdlib.h>
void main()
{
char buf[] = "409600.0000";
double frequency;
frequency = atof(buf);
printf("%g\n", frequency);
getchar();
}
The output
409600
What happens if you run this program on your VS2005 ?
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]
|
|
|
|
|
CPallini wrote: What happens if you run this program on your VS2005?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Found the prob. Was missing a header, stdlib.h fixed the problem.
|
|
|
|
|
I am using Visual Studio 2005.
And I want access to unordered_set storage containers.
They are apparently in TR1. whatever that is?
How can I be able to use them in my program?
Thanks
|
|
|
|
|
|
Hi
I'm a novice so excuse the basic questions!
I have Visual Studios 2005
And I want to use <unordered_set>.
Its not included it my list of include files.
Apparently it is in TR1 what ever that menans
How do I go about getting the files so that I can use unordered sets in the code I am trying to write
Many thanks for your time.
|
|
|
|
|
steph5 wrote: I'm a novice
Step 1: Put a subject on your post so people can click on it!
steph5 wrote: And I want to use .
Want to use what?
steph5 wrote: Apparently it is in TR1
I believe TR1 support was first added in the feature pack for Visual Studio 2008.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Lets try that agaiin!!!!
I can't even post a message. What chance do I have trying to program
I am trying to get unordered_set on my machine.
how can I get it?
p.s. if you put < and > it doesn't post in??
|
|
|
|
|
steph5 wrote: I am trying to get unordered_set on my machine.
You won't get it with Visual Studio 2005 (it's there in VS 2008 SP1).
You may want to try the Boost libraries[^]
steph5 wrote: p.s. if you put < and > it doesn't post in??
Not always - the text is interpreted as HTML and < starts an HTML tag.
In the formatting row below the editor window you'll find buttons to insert
< and >, or you can type the HTML for them yourself.
(this is pretty much the ONLY thing that really bugs me on this site...
I shouldn't have to go through and fix my posted code on a site with code
in the name... not all of us are HTML "programmers" )
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Many Thanks for your time and patience
|
|
|
|
|
Mark Salsbery wrote: not all of us are HTML "programmers"
So, the HTML guys insist on calling themselves as "programmers"? WTF. I need a hammer.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
I put the word in quotes....we all know they are just script kiddies.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Putting in a subject line is helpful, so folks know what they may expect when trying to open your post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
As an Aside, the thing won't open in my browser at all (Nothing to Click on) Is it not a Bug in CodeProject that you apparently can submit a question without a Subject Line. (Never tried it, and I won't, but me thinks that those who wrote the site should have done so).
Regards,
Bram van Kampen
|
|
|
|
|
You can actually press [Ctrl]+[Left Arrow] to navigate to the particular post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Intresting..I learned a new CP tip today
Regards,
Rane
|
|
|
|
|
hmm Never knew that. Hope I don't need it too often. Thanks anyways
Bram van Kampen
|
|
|
|
|
Hi All
I have Kept One MSFlexGrid Control on the view and rendering data in a specific tabular format where cell sizes are random throughout the document . only the width of document is fixed.
I want to print the same on print preview. how to do that.
regards
ulhas
|
|
|
|