|
Have you looked into the IHTMLDocument interface?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
thanks guys, but i am not sure but i think i have to dig more about IHTMLElement, anyway thanks a lot
|
|
|
|
|
Hi i have create a fuction to find how many words (str2) exist in line
int CInfoRecoverDlg::Compare( CString line , CString str2)
{
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if( !isalpha(line.GetAt(index-1)) && !isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
return nCount;
}
return nCount ;
}
When i compare 2 CString that i have initialize and give value throught my code everything work nice
like here
void CInfoRecoverDlg::OnButton1()
{
CString str1;
CString str = "yes";
CString line = "yes i said yes, yes yes ";
int nCount;
nCount = Compare( line , str);
str1.Format(_T("%d"), nCount);
AfxMessageBox(str1);
}
but when i compare 1 str (User give it throught application UI) with 1 line
(it get it from a file) things dont go well
<code> CArray<CString , CString> RArray;
CString FilePathName;
CString LineRead ;
CString str7;
int ntimes=0;
const int sz =100;
char buf[sz];
CString sl , slsl;
sl = "\\" ;
FilePathName = m_FolderName + FArray.GetAt(0);
m_List.AddString(FilePathName);
ifstream FileText(FilePathName);
while(FileText.get(buf,sz))
{
FileText.get();
LineRead = (LPCSTR) buf;
for ( int m = 0 ; m <WArray.GetSize() ; m++)
{
str7 = WArray.GetAt(m);
ntimes = ntimes + Compare(LineRead , str7);
}
}
FileText.close();
CString str13;
str13.Format(_T("%d"),ntimes);
AfxMessageBox(str13);</code>
|
|
|
|
|
Immunity18 wrote: ...things dont go well
Which means what? Have you stepped through Compare() to find out what is wrong?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i mean i have the same phrase in the file and in CString so it had to be the same result ?
when i try to debug it says "one or more breakpoints cant ..." and it show me a Kernel thing
|
|
|
|
|
Immunity18 wrote: i mean i have the same phrase in the file and in CString so it had to be the same result ?
Just because you pass a particular value to a method does not mean that same value is being "seen" by the method correctly. Set a breakpoint within the method and examine the values.
Immunity18 wrote: when i try to debug it says "one or more breakpoints cant ..." and it show me a Kernel thing
I'd be more concerned with this at the moment than I would be with why my code does not work. If you can't debug effectively, it's going to be a long road...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: I'd be more concerned with this at the moment than I would be with why my code does not work. If you can't debug effectively, it's going to be a long road...
Wrong :/ i was on Release mode
When i put breakpoint in the for {loop} so i get the compare value it give me a Debug error and while i press (ignore it) it doesnt
|
|
|
|
|
Immunity18 wrote: ...it give me a Debug error...
I assume you are referring to a debug assertion on the line containing isalpha() . If so, it should be apparent why this is happening. The first time through the loop, index is 0, and you are then passing -1 to the GetAt() method. Do you concur?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
in first i didnt have control it right and for index = 0 i passing -1 in getAt but now i think its right the code ? but still same debug assertion
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if ( index >1 )
{
if( 0 == isalpha(line.GetAt(index-1)) && 0 == isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
{
if(0 == isalpha(line.GetAt(index+ str2.GetLength())) )
{
nCount++;
index++;
}
}
}
else
return nCount;
}
return nCount ;
|
|
|
|
|
See here.
You indicate that the debug assertion is still happening, but you failed to indicate where, and what the call stack looked like at that point.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Immunity18 wrote: althought the results are differect
And those results would be what? Are you stepping throuygh the Compare() method? I doubt it, or would would have quickly seen that the last time through the loop, index is 30, which results in 33 being sent to the GetAt() method. Since the line being examined is only 33 characters long, the valid indices are 0-32.
Again I ask, what are you trying to accomplish with the code following the call to Find() ?
Immunity18 wrote: http://195.251.111.53/~labdb219/upload/correctvalues.bmp[^]
Try using a JPG so that a 2.3MB image does not have to be used. What exactly is this supposed to be showing? "How" you are calling the Compare() method is not the problem. It's what you are doing within it that is.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sorry about that. Well yes i did put a breakpoint inside Comare()
but it dont return me values (and .exe doesnt minimized)
still i have this error debug assertion link[^]
and my compare code is link[^]
int CInfoRecoverDlg::Compare2(CString line, CString str2)
{
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if ( index >1 )
{
if( 0 == isalpha(line.GetAt(index-1)) && 0 == isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
{
if(0 == isalpha(line.GetAt(index+ str2.GetLength())) )
{
nCount++;
index++;
}
}
}
else
return nCount;
}
return nCount ;
}
|
|
|
|
|
Immunity18 wrote: still i have this error debug assertion link[^]
So have you clicked on the Retry button, and then the Call Stack button? That'll show you exactly what the problem is, just as I described it earlier. It's not hard to fix, but you have to see it first to have a full understanding of what is happening.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i am doomed :/ there is an error link[^]
" An exception unknown softwore exception (.........) appeared in application in position 0x..... "
well thank you for your help :/ is there posibility to fix it?
my co-student from university called me to go to the beach so i would be back in 2-4 hours
|
|
|
|
|
well i did put a breakpointer as you said results are
line = {"yes i said yes, yes yes "}
str2 = {"yes"}
|
|
|
|
|
So what were the results of stepping through the code?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
the same wrong results :/
but i changed compare code (removed isalpha() ) and i created 2 Array [26] with A-Z and a-z and now it works perfectly just finished
Thank you for intersting !
|
|
|
|
|
Immunity18 wrote: the same wrong results :/
Which doesn't tell much.
Immunity18 wrote: ...i created 2 Array [26] with A-Z and a-z and now it works perfectly
So what exactly was this portion of your code doing? Are you for sure that using the two arrays instead of isalpha() is just not masking an underlying problem?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
well my opinion is what is working you dont touch it ! :P (greek phrase )
well when i end the project i think i will try to understand why that doesnt work
|
|
|
|
|
Immunity18 wrote: well my opinion is what is working...
That's my point. You have not actually verified whether it is working or not. Simply looking at the output as proof of whether a section of code works or not is just asking for trouble.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
about the debug yes its debug arrestion (how it is spelled:P)
my code is
int CInfoRecoverDlg::Compare( CString line , CString str2)
{
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if( !isalpha(line.GetAt(index-1)) && !isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
return nCount;
}
return nCount ;
}
Well yes i just want to complete the project (so i can give it ) and then i try to fingure out (my University teacher dont want to see C code correction but a program that work like google machine (give some words and return 10 top files.txt in chance to be what you want )
He asked us to make it in Visual Basic but as he teach us the Basic i felt i would confuse even more the C/C++ so i decide to make it in C/C++
|
|
|
|
|
hello
how can i read a stream from the sound card?
|
|
|
|
|
A couple popular ways are:
Windows Multimedia Waveform Audio[^]
DirectSound[^]
There's no performance advantage using DirectX (DirectSound) over windows multimedia for audio.
If you've done any DirectX coding, or already use DirectX in your code, then you may find
DirectSound easier.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|