|
Release and Debug mode, I both defined _UNICODE, UNICODE
I changed all TCHAR to wchar_t
But the problem still exists
|
|
|
|
|
Are you using cout<< to display you string? Show me the link that creates the problem.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
No I use cout to display a int value of the string
The word lib save the string like this
struct WORD_DATA
{
unsigned int hash;
TCHAR word[10];
unsigned int address;
unsigned int localAddr;
};
I use fwrite to write a WORD_DATA and fread to read from the file
First I segment string (such as "you") form source file and get the hash value of string then I go to hash table by index(unsiged int hash(such as 1020)) to find out if it in the table (if there is more than one word that having the same hash value I use wcscmp (wcscmp(WORD_DATA.word, "you")) to find the correct one)
But Release mode it all failed (can't be found) and Debug it runs correctly
At last if the word exists I push back the localAddr value to vector<int> then display all the results But Release mode because all failed to find no results displayed
If it still not clear I can post my program to you
Thank you so much
it's so kind of you
|
|
|
|
|
Tell me few things,
1. Are you writting the files in binary, or text mode? If text more, Are you able to read "see" the contents with your eyes? Are they written properly?
york528 wrote: But Release mode it all failed (can't be found) and Debug it runs correctly
2. Do you mean, the text file is written properly but it does not read the string properly? Also when you read the string "You" from the line, are you able to print the word on screen?
3. How do you construct the hash table? As and when you read the file you create the file? or it's loaded from somewhere?
--*---*
4. I prefer using fstreams. Why do you use fwrite? any specific reason?
5. Send the solution to dejavunic@gmail.com
6. I'll fix it for you tomorrow. But I'm not sure if I'll be free. So keep trying. When I get time, I'll do it for you.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
OK
I'll send my code to you and give you a detailed description about my code
I'll keep trying
If I can't figure out this problem I won't sleep well
And thank you sooooooo much
|
|
|
|
|
Hi VuNic
I found the mistake but I don't know why??
This is my hash function
int Hash::HashValUnicode(const TCHAR* src, const int nArrayLen)
{
register unsigned int h;
while (*src)
{
h = (h<<5) + h + *src++;
}
return h % nArrayLen;
}
In Debug and Release Mode
It gives diffirent hash values of the same UNICODE string
Such as "you" Debug it give 123 but Release 542(Just a example)
How dose it happened ???
Bad hash function???
|
|
|
|
|
OK
It works
Just because
register unsigned int h;
I should initail h;
register unsigned int h = 0;
like this both debug and release give the same hash value
such a little thing drive me crazy
now it's ok
thank you so much
and can we make a friend?
Emails me your MSN ID OK?
this email addr isn't my msn ID
Mine is techieyork@hotmail.com
|
|
|
|
|
There's a lot of difference between Release & Debug modes.
In debug mode variable gets automatically initialized. So you will not get an undefined behavior. But it's not the case with Release. And there's a lot of other differences between them. If you go through the below article, you'll get an idea.
Check This one[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Thank you
|
|
|
|
|
Hi all,
I have problem with showing png files in mfc.
I've used CImage::Draw function and CDC::AlphaBlend function but they don't work perfectly.
Please someone tell me how to draw a png file (with transparent background) perfectly...
Thank you.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Did you try?
CImage m;
m.Load(...);
m.BitBlt(0,0,640,480);
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
|
Hi all,
please tell me how can i get system drive path.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
|
thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You can also use GetWindowsDirectory or GetSystemDirectory .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
oops I'm late.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
GetSystemDirectory()
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
I've posted 56258974253021 message on this board and have read 54879652345 pages through google, but I've not been able to find a CLEAR answer to the following question:
1) Can I create a dynamic splitter window in a function THAN CFrameWnd::OnCreateClient? If yes, how to fill the CCreateContext parameter of CSplitterWnd::Create
Thank you masters!
|
|
|
|
|
You're right. Real programmers must be writing programs and not hanging around CP forums.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
you've obviously never heard the adage 'its easier to catch flies with honey than vinegar' .. your obvious contempt/disrespect for the real programmers here, who are likely working for a living, will mean you get sfa real responses .....
too bad - guess you can ask at rentacoder or the like
'g'
|
|
|
|
|
"I can only show you the door. You're the one that has to walk through it."
-Morpheus.
cuz basically showing is easy .
The Door.[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
VuNic wrote: "I can only show you the door. You're the one that has to walk through it."
If I konw it I said to him you must to eat the red pill .
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi Real programmer
Did you see Different Views In Dynamic Splitter[^]?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
You still have 56,204,094,600,676 more pages to read through.
"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
|
|
|
|