|
Hi All
I have a problem to call BOOL type function.I have declear a function in header file and calling in same header file.Then i am geting error
error C3861: 'str': identifier not found
Plz help me
|
|
|
|
|
Hi,
First check did you declared the variable 'str'.
Could you please show the function.
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
yes
public:
bool str();
and
bool CCall::str()
{
AfxMessageBox("Hello");
}
return false;
And i want to call str(); in .h file.
|
|
|
|
|
What I can see is this is a method of a class, not C-type function. You cannot call a method of a class that way.
Either you should create an instance of the class or you should declare the method as static.
modified 7-Mar-17 16:31pm.
|
|
|
|
|
cpvc++ wrote: return false;
Did this return statement escape?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Here's the problem:
I need to create a class "String" that is implemented as a linked list. This class should include the following string operations:
• String input and output
• A function which returns the string length
• A function which returns the nth character, where the first character is number 1
• Overloaded operators = (assignment), ==, !=, <, >, <= and >= (relational).
I then need to write a class "N" as a subclass of class "String". This class "N" should include an isPostfix Boolean function which determines whether or not a String is a postfix expression, where the operands of the expression are a single lowercase letter, and the operator is +, -, * or /. I will not have to evaluate any postfix expressions.
Does anyone know how do do this or has done this before? Any help would be greatly appreciated. thanks.
|
|
|
|
|
Would you like us to bring you a cup of tea as well?
|
|
|
|
|
shadoweKnight wrote: I then need to write a class...
Which means you, not us.
shadoweKnight wrote: Does anyone know how do do this...
Yes.
shadoweKnight wrote: ...has done this before?
Possibly.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
here is the code that I have so far... again, any help would be appreciated.
#include <iostream>
#include <string>
#include "SimpleString.h"
using namespace std;
SimpleString::output (string S)
{
}
SimpleString::input()
{
}
int SimpleString::getLength()
{
int count = 0;
nodePtr cur;
cur = head;
do
{
count++;
cur =cur->next;
}
while (cur->next != NULL);
return count;
}
char SimpleString::nthChar (int num)
{
nodePtr cur;
cur = head;
for (int x = 0; x <=num; x++)
{
if (cur->next != NULL)
cur = cur->next;
}
return cur;
}
bool operator= (SimpleString& S)
{
if (size = S.getLength())
return true;
else
return false;
}
bool operator== (SimpleString& S)
{
if (size == S.getLength())
return true;
else
return false;
}
bool operator!= (SimpleString& S)
{
if (size != S.getLength())
return true;
else
return false;
}
bool operator< (SimpleString& S)
{
if (size < S.getLength())
return true;
else
return false;
}
bool operator> (SimpleString& S)
{
if (size > S.getLength())
return true;
else
return false;
}
bool operator >= (SimpleString& S)
{
if (size >= S.getLength())
return true;
else
return false;
}
bool operator <= (SimpleString& S)
{
if (size <= S.getLength())
return true;
else
return false;
}
bool isPostfix ()
{
}
</string></iostream>
#include <iostream>
#include <string>
#include "List.h"
using namespace std;
class SimpleString
{
protected:
struct Node
{
char item;
Node *next;
}
Node *head;
head = new Node;
char Node* nodePtr;
int size;
public:
void output (string S);
srtring input();
char getLength();
char nthChar (int num);
bool operator= (const SimpleString& S);
bool operator== (const SimpleString& S);
bool operator!= (const SimpleString& S);
bool operator< (const SimpleString& S);
bool operator> (const SimpleString& S);
bool operator<= (const SimpleString& S);
bool operator>= (const SimpleString& S);
};
class postfixExpression : public SimpleString
{
public:
bool isPostfix();
};</string></iostream>
|
|
|
|
|
There is a short block of code:
<br />
1: typedef deque<int> IntDeque;<br />
2: IntDeque q;<br />
3: IntDeque::iterator it = q.begin();
4: q.push_back(12);<br />
5: if(it==q.end()){<br />
6: cout<<"The end of the deque."<<endl;<br />
7: }</int>
The code will crash at the 5th line because of a internal exception in STL. But i really need a iterator variable to hold a specified iterator in the deque. For example, if i want it to hold the second iterator no matter i push how many new items into the deque. But, in msdn, the comments about push_back says that, this function "Inserting the element invalidates all iterators, but no references, to existing elements". This might be the reason. I tested this code in VC6 and VC2005 and got the same error.
But, this code will work well under Linux platform.
So, i wanna know if this is a difference about the implements of STL deque between MS and Linux?
|
|
|
|
|
kcynic wrote: This might be the reason
the docs says it is. i'd trust them.
|
|
|
|
|
btw, do you know mkvtoolnix? there has some code in it. so, it will crash because of such problem.
|
|
|
|
|
kcynic wrote: So, i wanna know if this is a difference about the implements of STL deque between MS and Linux?
Both MS and Linux implements the STL and follow the standards (well, you would suppose so ). In this particular case, the STL is probably saying that accessing an invalid iterator leads to undefined results. So, MS and Linux simply implement the undefined behavior differently.
|
|
|
|
|
Hello!
I have hwnd of a window I found using FindWindow(), and I want to wait until the user will close this window.
I can think of 2 approches:
(1) better one - get a callback or wait (like waitforsingleobject) until the user closes the window.
(2) not as good as I want - recheck a function that returns the window's state.
I'm looking for a while for a function that does one of these, but with no luck...
Anyone can help me with that???
Thanks a lot in advance!
|
|
|
|
|
SetWindowsHookEx using the WH_CBT hook and looking for the HCBT_DESTROYWND flag. See MSDN for more info.
|
|
|
|
|
try this:
SetTimer(...., TimerProc);
.
.
.
... TimerProc (...)
{
if(IsWindow(hWnd)
}
Thank you masters!
|
|
|
|
|
|
Hi,
I am using the following method to get the scancode for the keyboard keys.But it fails to give me the scancode for F1 to F12 keys. Please tell me what can i do to retrieve the scan code for the above said keys.
UINT lKey = (MapVirtualKey(key, 0) << 16) | (1 << 24);
Thanks in advance,
John.
|
|
|
|
|
This
UINT scancode = ::MapVirtualKey(VK_F1, MAPVK_VK_TO_VSC);
gives me a scan code of 0x3B. Isn't that the F1 scan code?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I try to resize a Custom Control in the OnSize Function of my Views OnSize Function. There is no Error, but nothing happens:
afx_msg void CCustomView::OnSize(UINT nType, int cx, int cy) {
if (::IsWindow(m_datagrid)) {
m_datagrid.SetWindowPos(&wndTopMost, 12, 48, 500, 500, SWP_NOZORDER | SWP_NOMOVE);
}
CView::OnSize(nType, cx, cy);
}
What am I do wrong? m_datagrid.SetWindowPos is executed, I checked it by debugging.
Thank you for your help,
Johannes
|
|
|
|
|
What are you wanting to happen?
You use wndTopMost but it's ignored because of SWP_NOZORDER.
You use x and y positions but they're ignored because of SWP_NOMOVE.
That leaves resize
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, it would have been better if I posted the code without the flags.
When I do not use the Flags it`s the same thing: My Custom control is not be resized and not moved, and this is what I want it to do...
|
|
|
|
|
If you want to move and resize, just use MoveWindow().
The other problem may be where you're doing it from.
The view may not get a WM_SIZE message after the child window
you're moving is created (until the next time the view is resized).
Put a breakpoint on the SetWindowPos() call to check.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
thank you. With MoveWindow() it works!
|
|
|
|
|
I have two programs that share a pipe, a server and a client.
The server creates the pipe and then calls
ConnectNamedPipe(pipe_name, NULL);
The client opens the pipe
CreateFile(
pipe_name,
GENERIC_READ |
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
But I need to know if the pipe exists even if the server has not called ConnectNamedPipe. Then I need the client to wait forever until the server calls ConnectNamedPipe. But if the pipe is not there at all, it should skip. Any way to do that?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|