|
Most likely yes, and Google will find them for you.
|
|
|
|
|
Hi
I am trying to concatenate a number of CString, problem is After the third it includes the NULL termination which delimits the string. Let me post the code
b_command, prog_location, end_addr and casid2 are all of type CString
int starters = strtol(prog_location,&hold_ptr,16);
int enders = starters + progsize;
_itoa(enders,p = end_addr.GetBuffer(0),16);
b_command = b_command + prog_location + "-" + end_addr + " " + casid2;
b_command, prog_location, end_addr, and casid2 are all strings
After b_commnd = .....
the string containing end_addr has the NULL marker included in b_command making the data casid2 invisible I can see that casid2 is there after the NULL by looking in memory
|
|
|
|
|
You must call ReleaseBuffer() after changing the string. While not doing so the CString object may be in an undefined state. See CSimpleStringT::GetBuffer[^]:
Quote: If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before you use any other CSimpleStringT member methods.
So use:
_itoa(enders,p = end_addr.GetBuffer(0),16);
end_addr.ReleaseBuffer();
|
|
|
|
|
worked
Thanks
|
|
|
|
|
|
I found out that
__interface I { };
class __declspc(dllexport) C: public I
{
} does not work because C then needs the assigment operator I::operator =() when compiler generates default implementation of C::operator =(const C&)
I can overcome this implmenting a C::operator=
but whats the reason of implementing operator = for dllexport?
any other way to solve this?
|
|
|
|
|
how to make the operator shift up and shift down on the language C++ ?
and if there are any who understand the line- shift coding method in steganography ?
please help me, i'm a newbie
thankyou 
|
|
|
|
|
Quote: how to make the operator shift up and shift down on the language C++ ? Sorry? What is the operator 'shift up' (and 'shift down'?)?
Quote: and if there are any who understand the line- shift coding method in steganography ?
please help me, i'm a newbie
You should know, of course.
Remember, Google is the friend of all the newbies[^].
|
|
|
|
|
in the line- shift coding method , using ways of working to manipulate the document by shifting the vertical lines of text based on the bits you want to insert. so what steps should I do if I make a program with the method using c ++ ?
thank you 
|
|
|
|
|
No work for that one
OpenStego - Home[^]
It's open Source code the code is free to download, that will get you started.
In vino veritas
|
|
|
|
|
I have declared a simpl interface using
__interface ImyInterface
{
virtual Method1() abstract;
virtual Method2() abstract;
};
class MyClass : public ImyInterface, public CBase
{
public:
MyClass();
virtual ~MyClass();
virtual Method1();
virtual Method2();
protected:
int member1, member2;
};
This is implemented in big code where I use downcasts like
CBase* ptr = new CMyClass();
dynamic_cast<ImyInterface*>(ptr);
and some other typecasting of ImyInterface* found only by "search complete project"
on one hand destructors are not allowed in an Interface because __interface uses __declspec(novtable)
on the other hand the compiler wants to have a destructor
(error is shown at "}" of the derived class)
What constructs in the code will force the compile to raise this error, and, is the usage of __interface in c++ too special for interfaces and I should use struct only?.
In common: when never use interface as a base of a class?
modified 21-Jul-16 2:57am.
|
|
|
|
|
found out the bugmyself now
I used the virtual keyword in the declaration
class MyClass : virtual public ImyInterface, public CBase
removing the virtual keyword makes the error disappear 
|
|
|
|
|
Can anyone tell me how can I access the x in the following statement: FirstClass obj3(200, 300);
Here Y = 200, X = 300;
X is initialized by calling the constructor BaseClass(x)
FirstClass inherits BaseClass with protected access specifier.
#include <iostream>
using namespace std;
class BaseClass
{
private:
int x;
public:
BaseClass()
{
cout << "\n BaseClass(default) called." << endl;
}
BaseClass(int x)
{
cout << "\n BaseClass(parameters) called." << endl;
this->x = x;
}
int getX()
{
return x;
}
};
class FirstClass:protected BaseClass
{
private:
int y;
public:
FirstClass(int y, int x):BaseClass(x)
{
cout << "\n FirstClass(parameters) called." << endl;
this->y = y;
}
int getY()
{
return y;
}
};
int main()
{
BaseClass obj1;
BaseClass obj2(100);
cout << "\n X = " << obj2.getX() << endl;
FirstClass obj3(200, 300);
cout << "\n Y = " << obj3.getY() << endl;
return 0;
}
|
|
|
|
|
|
I know the protected access specifier.
In my code I need a function into FirstClass() to call function getX() from BaseClass, and I tried but I did not succeed.
|
|
|
|
|
You have been given the answer to this twice already in your original post two days ago[^]. You are trying to access an uninitialised variable in an object (obj1). Build your program and step through the code with the debugger and you will be able to see exactly what happens.
|
|
|
|
|
kinderu wrote: Can anyone tell me how can I access the x in the following statement: FirstClass obj3(200, 300); Taken at face value, this really makes no sense. The member variable x belongs to the BaseClass class. So, are you wanting to access x in the context of obj3 , or from within BaseClass , FirstClass , or main() ?
As it stands right now, your code does indeed assign x a value, but then you have no code to print it (like you do for y ).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
this code is what I want to achieve
#include <iostream>
using namespace std;
class BaseClass
{
private:
int x;
public:
BaseClass()
{
cout << "\n BaseClass(default) called." << endl;
}
BaseClass(int x)
{
cout << "\n BaseClass(parameter) called." << endl;
this->x = x;
}
int getX()
{
return x;
}
};
class FirstClass:protected BaseClass
{
private:
int y;
public:
FirstClass(int y, int x):BaseClass(x)
{
cout << "\n FirstClass(parameter) called." << endl;
this->y = y;
}
int getY()
{
return y;
}
int getXX()
{
return getX();
}
};
int main()
{
BaseClass obj1;
BaseClass obj2(100);
cout << "\n X = " << obj2.getX() << endl;
FirstClass obj3(200, 300);
cout << "\n Y = " << obj3.getY() << endl;
cout << "\n X = " << obj3.getXX() << endl;
return 0;
}
|
|
|
|
|
So what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
That should all work; what happens when you run this code?
|
|
|
|
|
When I run the code shows:
BaseClass(default) called.
BaseClass(parameter) called.
X = 100
BaseClass(parameter) called.
FirstClass(parameter) called.
Y = 200
X = 300
wich is ok
|
|
|
|
|
Excellent, you have solved your problem.
|
|
|
|
|
Hi,
I want to debug COM dll solution through another ASP.Net solution (IIS).
Solution A - COM dll which outputs 4 com dll's.
Solution B - ASP.Net which access, solution A COM dll's. This solution was hosted in IIS
Solution B I able to debug through Visualstudio->Debug->attachtoprocess->w3wp.exe
But when solution B calls COM dll which is from solution A , I cannot debug Solution A(COM Dll).
Please suggest solution for debugging.
(Usually I debug the dll solution through
VS->Project->properties->Debugging->command->setting target exe path. But here it is asp.net solution, so I don't know what to give in Target exe path)
|
|
|
|
|
I have the following code.
Why does not my x is displayed.
I do not understand, X is returned by the getX() function wich is called from the derived class SecondClass() through an object of type FirstClass().
Initialization of X was done using constructor function FirstClass(int x).
I did not want to use the initialization function like setX ().
#include <iostream>
using namespace std;
class FirstClass
{
private:
int x;
public:
FirstClass()
{
cout << "\n Default constructor FirstClass()." << endl;
}
FirstClass(int x)
{
cout << "\n Constructor FirstClass()." << endl;
this->x = x;
cout << "\n X = " << x << endl;
}
int getX()
{
return x;
}
};
class SecondClass:protected FirstClass
{
private:
int y;
public:
SecondClass(int x):FirstClass(x)
{
cout << "\n Constructor SecondClass()." << endl;
}
void printX(FirstClass& obj)
{
cout << "\n X = " << obj.getX() << endl;
}
};
int main()
{
FirstClass box1;
SecondClass box2(100);
box2.printX(box1);
return 0;
}
|
|
|
|
|
You have two instances of FirstClass here - one inside the instance of SecondClass and one is standalone. You used the default constructor for the standalone instance, which does not initialize x. You then printed this uninitialized value.
Please note that a class declaration is not the definition of a class instance!
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|