Hello Cédric Moonen,, Sorry saw yr response now.Thanks a lot for the reply. I am very much new to the Thread Concept. thought of learning the basics of threads. can anyone suggest me some nice basic Article to start with. Thanking you, Suresh
Suresh H
Posts
-
How to Kill the Worker Thread ? -
How to Kill the Worker Thread ?Hello Everyone,, Sorry saw all yr response now.Thanks a lot for the reply. I am very much new to the Thread Concept. thought of learning the basics of threads. can anyone suggest me some nice Article to start with. Thanking you, Suresh
-
How to Kill the Worker Thread ?Hi Parag Patel, Thanks for the reply. I tried with this below code but still the thread is running its not terminated, can u please tell how to kill the thread.
void CThreadDemoDlg::OnEnd()
{
// TODO: Add your control notification handler code hereTerminateThread(hr1,1); TerminateThread(hr2,1);
}
-
How to Kill the Worker Thread ?Hello Everyone, I have Demo MFC application, with 2 buttons Start and End Button. Start button will start 2 threads
void CThreadDemoDlg::OnStart()
{
// TODO: Add your control notification handler code hereHANDLE hr1,hr2; hr1 = CreateThread(NULL,0,(unsigned long (\_\_stdcall \*)(void \*))WorkerThreadOne,this,0,0); hr2 = CreateThread(NULL,0,(unsigned long (\_\_stdcall \*)(void \*))WorkerThreadTwo,this,0,0);
}
UINT WorkerThreadOne(LPVOID Param)
{
fstream OutFile;
OutFile.open("FileOne.txt",ios::out);for(int i=0;i<10000;i++) OutFile << i << " "; OutFile.close(); return true;
}
Can anyone please tell me how to kill the thread ? OnEnd click. Thanking you, Suresh.
-
Simple Class [modified]Hi, why is the size of the empty class is one
class Demo { }; void main() { int size; size=sizeof(Demo); cout << " Size oF Class:" << size; }
OutPut :- Size oF Class: 1 Can anyone please tell me the reason ?? why its 1. -
How to get IP adress?use IPM_GETADDRESS Message Retrieves the address values for all four fields in the IP address control. Syntax To send this message, call the SendMessage function as follows. lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) IPM_GETADDRESS, // message ID (WPARAM) wParam, // = 0; not used, must be zero (LPARAM) lParam // = (LPARAM) (LPDWORD) pdwAddr; );
-
How to check the ASCII value ??Hi Prasad, Thank you very much for the help. i made changes a below and its working now perfectly. i had never used isalpha so i was with ascii code, thanks for the info.
while(!fin.eof()) { fin >> word; //strlwr(word); wsize = strlen(word); offset=fin.tellg(); offset = offset - wsize + 1; //Insert Words and its offset in to Map stemp = word; bool bValid = true; for (int j = 0; j < wsize; j++) { if (!isalpha(stemp[j])) { bValid = false; break; } } if (bValid) FMap[stemp] = offset; }
-
How to check the ASCII value ??Hi Appu,, Thank you very much, code is working i made the changes as below
while(!fin.eof()) { fin >> word; //strlwr(word); wsize = strlen(word); offset=fin.tellg(); offset = offset - wsize + 1; //Insert Words and its offset in to Map stemp = word; bool bValid = true; for (int j = 0; j < wsize; j++) { if (!isalpha(stemp[j])) { bValid = false; break; } } if (bValid) FMap[stemp] = offset; }
-
How to check the ASCII value ??Appu still the problem is there not got the solution still..... i changed the code as below now it only checks for the 1st character if that is valid it will add it to map .. if ( ((stemp[0] >= 65) && (stemp[0] <= 90)) || ((stemp[0] >= 97) && (stemp[0] <= 122)) ) FMap[stemp]=offset; but hwy to check if there is any special character or number in between and hw to add them??
-
How to check the ASCII value ??using namespace std; typedef map FileMap; #define SIZE 255 char word[SIZE]; int offset; FileMap FMap; i forgot to enable Ignore HTML tags in this message (good for code snippets) -- modified at 4:30 Friday 30th March, 2007
-
How to check the ASCII value ??appu i made changes but i am getting error for this lines FMap[nIndex++] = stemp[j]; /* Not FMap[stemp] = offset */ error C2679: binary '[' : no operator defined which takes a right-hand operand of type 'int' (or there is no acceptable conversion) FMap[nIndex] = '\0'; /* NULL termination */ error C2679: binary '[' : no operator defined which takes a right-hand operand of type 'int' (or there is no acceptable conversion) Now the problem with adding values to Map.
-
How to check the ASCII value ??I copied and pasted but still nt working :( again the same output
for(int j =0; j<=wsize; j++) { if ( ((stemp[j] >= 65) && (stemp[j] <= 90)) || ((stemp[j] >= 97) && (stemp[j] <= 122)) ) { FMap[stemp]=offset; } }
-
How to check the ASCII value ??i checked it and added brackets but still no effect same output
for(int j =0; j<=wsize; j++) { if ( ((stemp[j] >= 65) && (stemp[j] <= 90) || (stemp[j] >= 97) && (stemp[j] <= 122) ) ) { FMap[stemp]=offset; } }
-
How to check the ASCII value ??Hi Prasad, Code as no effect its adding all the words.
void getoff(char *fname) { ifstream fin; fin.open(fname,ios::in); int wsize; string stemp; //Loops till the end of the file. while(!fin.eof()) { fin >> word; strlwr(word); wsize = strlen(word); offset=fin.tellg(); offset = offset - wsize + 1; //Insert Words and its offset in to Map stemp = word; for(int j =0; j < wsize; j++) { if (isalpha(stemp[j])) { FMap[stemp] = offset; } } } fin.close(); }
-
How to check the ASCII value ??Hi Appu, Thanks for the response, I made changes but the code as no effect its adding all the words. Including numbers and special characters.
for(int j =0; j<=wsize; j++) { if ( (stemp[j] >= 65) && (stemp[j] <= 90) || (stemp[j] >= 97) && (stemp[j] <= 122) ) { FMap[stemp]=offset; } } }
Something is wrong in the for loop i am unable to find, what will the cause ? -
How to check the ASCII value ??Thanks Cedric Moonen for the response. ASCII values A – 65 to Z – 90 & a – 97 to z – 122. But hw to check them in the condition ???
-
How to check the ASCII value ??Hello All, I am trying a read text file and extracting words from it and adding to a map. I want to add only valid words and eliminate numbers and special character words and then add it to map. Invalid words like 1word , hello# , t2o etc … so I want to eliminate all the number and special characters. Can anyone please help me with this …. strlwr(word); wsize = strlen(word); stemp = word; for(int j =0; j<=wsize; j++) { if ( stemp[j] == '.' || stemp[j] == ';' || stemp[j] == '*' || stemp[j] == '#' && stemp[j] == '!' || stemp[j] == '@' || stemp[j] == '$' || stemp[j] == '%' && stemp[j] == '^' || stemp[j] == '&' || stemp[j] == '(' || stemp[j] == ')' && stemp[j] == '-' || stemp[j] == '+' || stemp[j] == '/' ) break; else FMap[stemp]=offset; } This conditions are very lengthy, is there any way I can reduce it by checking the ASCII value and add them to MAP. Thanking you, Suresh HC.
-
After the shameful defeat of Team India, [moved]are u SACHIN ?????? Ho Noooooooooooooooooooooooooo :doh:
-
FunnyGood one ..Thanks for posting ..........:laugh:
-
AOTD:-D