UNICODE problem??
-
You need to set them for both Release & debug's property pages. Did you do that for both?
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 just set them in project->settings delete _MBCS and add _UNICODE,UNICODE I am wondering if I use TCHAR cause this problem because for ansi build TCHAR = char How I change the setting for both of them This is the first time using UNICODE ;P Thank you VuNic
-
I just set them in project->settings delete _MBCS and add _UNICODE,UNICODE I am wondering if I use TCHAR cause this problem because for ansi build TCHAR = char How I change the setting for both of them This is the first time using UNICODE ;P Thank you VuNic
If you are using TCHAR then there shouldn't be a problem. But it also counts how are you using it.
york528 wrote:
I just set them in project->settings delete _MBCS and add _UNICODE,UNICODE
Yes, this is fine. You need to repeat the same after you choose "Release" version. Because the settings you give in the project properties in debug mode applies only to debug versions. ReDo the same after you choose "Release". This is what I asked you to check.
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
-
If you are using TCHAR then there shouldn't be a problem. But it also counts how are you using it.
york528 wrote:
I just set them in project->settings delete _MBCS and add _UNICODE,UNICODE
Yes, this is fine. You need to repeat the same after you choose "Release" version. Because the settings you give in the project properties in debug mode applies only to debug versions. ReDo the same after you choose "Release". This is what I asked you to check.
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 will check that Now I am not at my computer About TCHAR I use in a struct
struct WORD_DATA
{
TCHAR word[10];
unsigned int hashVal;
unsigned int localAddr;
};This struct is for READ & WRITE a UNICODE word file It saves the data about word so I can use them to segmentation So is that TCHAR using correct?? and what suggestion do you have forme in UNICODE programming? ;P
-
I will check that Now I am not at my computer About TCHAR I use in a struct
struct WORD_DATA
{
TCHAR word[10];
unsigned int hashVal;
unsigned int localAddr;
};This struct is for READ & WRITE a UNICODE word file It saves the data about word so I can use them to segmentation So is that TCHAR using correct?? and what suggestion do you have forme in UNICODE programming? ;P
There's a nice article from Chris itself :Click[^]Search for "Reading and Writing ASCII text files" in the article. Your problem would be addressed. Also you may check this one:Clicky[^]
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
-
There's a nice article from Chris itself :Click[^]Search for "Reading and Writing ASCII text files" in the article. Your problem would be addressed. Also you may check this one:Clicky[^]
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
-
Release and Debug mode, I both defined _UNICODE, UNICODE I changed all TCHAR to wchar_t But the problem still exists :confused::confused::confused:
-
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 then display all the results But Release mode because all failed to find no results displayed :confused: X| If it still not clear I can post my program to you Thank you so much it's so kind of you
-
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 then display all the results But Release mode because all failed to find no results displayed :confused: X| 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
-
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
-
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
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???
-
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 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
-
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
-
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