Click here to Skip to main content
15,891,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog size does not change when DPI settings change Pin
_T("No name")20-Dec-09 20:49
_T("No name")20-Dec-09 20:49 
GeneralRe: Dialog size does not change when DPI settings change Pin
CPallini20-Dec-09 22:28
mveCPallini20-Dec-09 22:28 
GeneralRe: Dialog size does not change when DPI settings change Pin
_T("No name")20-Dec-09 22:38
_T("No name")20-Dec-09 22:38 
GeneralRe: Dialog size does not change when DPI settings change Pin
CPallini21-Dec-09 1:45
mveCPallini21-Dec-09 1:45 
Questioncharacter comparision...case insensitive Pin
hrishiS20-Dec-09 18:22
hrishiS20-Dec-09 18:22 
AnswerRe: character comparision...case insensitive Pin
«_Superman_»20-Dec-09 20:13
professional«_Superman_»20-Dec-09 20:13 
GeneralRe: character comparision...case insensitive Pin
hrishiS20-Dec-09 20:36
hrishiS20-Dec-09 20:36 
QuestionCString Word Count and Word Search Pin
kiddyduck20-Dec-09 16:02
kiddyduck20-Dec-09 16:02 
I have been working on this problem for a long time and with no progress.
I am trying to count the number of words in a CString and other punctuation and specific word counts.
My code is working properly for .txt files using ifstream and stringstream.

However when I was trying to convert those codes from txt files to CString, errors came in such as conversion error between CString and Stringstream. Will appreciate if you can take a look at my codes and suggest a solution. Thanks a lot!

CString Content("some text inside");
string file,line,word,temp;
stringstream *ss;
map<string,int> freq;
map<string,int>::iterator z

stringstream myfile(Content);

while (! myfile.eof() )
{
// Line & Word Counts
while (getline (myfile,line)){
++lineCnt;
ss = new stringstream(Content);
while (ss->good()){
if ((*ss)>>word){
++dwordCnt;
if ((z=freq.find(word)) == freq.end()){
freq.insert(pair<string,int>(word,1));
}else {
freq[word]++;
}
//Semi-colon Count
size_t p=0;
size_t n=0;
size_t m=0;
size_t j=0;
while ((p = word.find(';',p)) != string::npos){
++semiCnt; ++p;
}
while ((n = word.find('.',n)) != string::npos){
++stopCnt; ++n;
}
while ((m = word.find('?',m)) != string::npos){
++QueCnt; ++m;
}
while ((j = word.find('!',j)) != string::npos){
++exclCnt; ++j;
}
}
}
delete ss;
}
}

for (z = freq.begin();z != freq.end(); ++z) {
if (z->second == 1) ++duniqCnt;
if ((z->first).find(BUT) != string::npos) ++butCnt;
if ((z->first).find(AND) != string::npos) ++andCnt;
if ((z->first).find(HENCE) != string::npos) ++henceCnt;
if ((z->first).find(WHILE) != string::npos) ++whileCnt;
if ((z->first).find(BECAUSE) != string::npos) ++becauseCnt;
if ((z->first).find(AS) != string::npos) ++asCnt;
if ((z->first).find(SHALL) != string::npos) ++shallCnt;
if ((z->first).find(THE) != string::npos) ++theCnt;
if ((z->first).find(OF) != string::npos) ++ofCnt;
}
QuestionRe: CString Word Count and Word Search Pin
David Crow20-Dec-09 17:52
David Crow20-Dec-09 17:52 
AnswerRe: CString Word Count and Word Search Pin
kiddyduck22-Dec-09 14:26
kiddyduck22-Dec-09 14:26 
GeneralRe: CString Word Count and Word Search Pin
David Crow22-Dec-09 16:17
David Crow22-Dec-09 16:17 
GeneralRe: CString Word Count and Word Search Pin
kiddyduck22-Dec-09 16:38
kiddyduck22-Dec-09 16:38 
QuestionWhen does Message Queue get created in window programming? Pin
Prabhu09200920-Dec-09 2:18
Prabhu09200920-Dec-09 2:18 
AnswerRe: When does Message Queue get created in window programming? Pin
enhzflep20-Dec-09 3:09
enhzflep20-Dec-09 3:09 
AnswerRe: When does Message Queue get created in window programming? Pin
Richard MacCutchan20-Dec-09 4:33
mveRichard MacCutchan20-Dec-09 4:33 
AnswerRe: When does Message Queue get created in window programming? Pin
CPallini20-Dec-09 4:47
mveCPallini20-Dec-09 4:47 
GeneralRe: When does Message Queue get created in window programming? Pin
Luc Pattyn20-Dec-09 5:40
sitebuilderLuc Pattyn20-Dec-09 5:40 
GeneralRe: When does Message Queue get created in window programming? Pin
CPallini20-Dec-09 7:33
mveCPallini20-Dec-09 7:33 
AnswerRe: When does Message Queue get created in window programming? Pin
«_Superman_»20-Dec-09 4:51
professional«_Superman_»20-Dec-09 4:51 
AnswerRe: When does Message Queue get created in window programming? Pin
Prabhu09200920-Dec-09 20:12
Prabhu09200920-Dec-09 20:12 
QuestionStrange Initialize.......... Pin
milestanley19-Dec-09 17:49
milestanley19-Dec-09 17:49 
AnswerRe: Strange Initialize.......... Pin
Chris Losinger19-Dec-09 19:31
professionalChris Losinger19-Dec-09 19:31 
AnswerRe: Strange Initialize.......... Pin
Richard MacCutchan19-Dec-09 21:40
mveRichard MacCutchan19-Dec-09 21:40 
AnswerRe: Strange Initialize.......... Pin
«_Superman_»20-Dec-09 4:57
professional«_Superman_»20-Dec-09 4:57 
Questionhow to use this code ?? Pin
a04.lqd19-Dec-09 6:19
a04.lqd19-Dec-09 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.