I thought it is about the program language Now I know the complier do this, Thank you ;P
york528
Posts
-
operator over loading problem? -
operator over loading problem?Hi, I'm sorry that I made a mistake! what I mean is when I use STL::map or else Using iterator as a left value and a map<X,Y> as a parameter of a function as bellow
void func(const map<X,Y> mapUsed)
{
map<X,Y>::iterator iterMap = mapUsed.begin(); //IDE report wrong here
while(iterMap != mapUsed.end())
{
//do something
}
}mapUsed.begin() returned a const_iterator it dosen't match with iterator I was confusing that how dose mapUsed know itself is a const one and return const_iterator Did the IDE do it for us or STL used some other way? Thanks a lot!
-
operator over loading problem?lately when I use STL map as a parameter in a function I have a problem? such as:
void func(const map<struct>& mapUsed)
{
map<struct>::iterator iterMap = mapUsed.begin()
while(iterMap != mapUsed.end())
{
//do something
}
}The vs2008 report an error and when I use const_iterator to instead random iterator It's ok And I wanna know If STL use "const" overloading such as operator == ... If not ? How dose STL do? Thanks a lot! :doh:
-
file share problemThank you!~~~ :laugh: I'll think about it and consider Randor's idea
-
file share problemThank you for reply I care more about speed Only one server almost 3GB index file is to be read by lots of people you know No matter how a program is perfect, slow speed still can't be acceptable Randor's idea is good I don't know the efficiency in this way
-
file share problemspeed is important IO is slower than file mapping that's why I wanna use it Best Wishes One day I will get what I wish by working hard
-
file share problemThank you I'll try that :-D :thumbsup:
-
file share problemThank you so much I read the book Programming Applications for Microsoft Windows by Jeffrey Richter but biside file mapping Is there another way to share a big file in one time I always wanna find a better way :)
-
file share problemnot that problem when I create a file mapping that the file is bigger than 1.5Gb the CreateFileMapping return ERROR_NOT_ENOUGH_MEMORY And I was wondering if I can map a big file (3-4G) to share in one time that's what I want for example I have a 3G file and 100 people wanna read it so I wanna share it that's the situation Thank you !~
-
file share problemI forgot. It means to share a big file between multi-process so all the processes can read the file Thank you!~
-
file share problemI just wanna know how to share a big file, 3-4G when using FileMapping, I only can share a file that not bigger than 1.5G if bigger than that, I got an error of ERROR_NOT_ENOUGH_MEMORY Thanks!
-
UNICODE problem??Thank you :-O
-
UNICODE problem??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
-
UNICODE problem??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???
-
UNICODE problem??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
-
UNICODE problem??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
-
UNICODE problem??Release and Debug mode, I both defined _UNICODE, UNICODE I changed all TCHAR to wchar_t But the problem still exists :confused::confused::confused:
-
UNICODE problem??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
-
UNICODE problem??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
-
UNICODE problem??I wrote a console program in UNICODE to surpport multi-language But the DEBUG and RELEASE have diffirent results I've already defined _UNICODE,UNICODE who can tell me? Thank you !~~ And my console can output UNICODE character , just output a number how can I do ? Thanks~~~~~~~~~~~~~~~~~~~~~