|
Hi Everyone,
I'm working on a NT service which calls other Services in another machine. I know that for unit testing we can write stubs for other remote services to test the service. I've searched on the net but i couldn't find any tutorial to do this. Can anyone please tell me how to write stubs (the basic idea, i've absolutely no idea where to start) or direct me to any tutorial that would help me??
Regards,
|
|
|
|
|
You just write a method with the same signature as the 'real' function, and add your own code to return a good or bad status as appropriate. For example the Windows function GetFileVersionInfo() could be coded like this
BOOL GetFileVersionInfo(LPCTSTR lptstrFilename,
DWORD dwHandle,
DWORD dwLen,
LPVOID lpData
)
{
OutputDebugString("My test");
return TRUE;
}
MVP 2010 - are they mad?
|
|
|
|
|
SQL server database can have LSN number(Log sequence number) in 25 digit
so maximum value of that LSN can be 9999999999999999999999999
that is 25 times 999...
I cannot use string to store it because i need to perform some arithemetic operations like addation,substrication on it
so in C++ which datatype can i used to store it.
|
|
|
|
|
s v joshi wrote: C++ which datatype can i used to store it
There isn't.
You may store your number into two __int64 variables.
Another option would be using a big integer library, like, for instance, the GNU GMP.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is __int256 not an option?
I guess is not standard, but there are quite hits in google for 128 and 256 integers.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: Is __int256 not an option?
A __int128 would be enough. Anyway it is not a built in type. You may find a lot of available solution on the web, I suppose (or you may roll your own, it is amusing...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
does this[^] help you?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks , this solves my problem.
|
|
|
|
|
Glad to hear it You are welcome.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Normally it is
ABCD
EFGH
IJKL
MNOP
QRST
UVWX
YZ
while I want is :
Y U Q M I E A
Z V R N J F B
W S O K G C
X T P L H D
|
|
|
|
|
You can either format the text before setting it to the edit box or handle the EN_CHANGE notification sent to the parent window class of the edit control and format the text accordingly.
|
|
|
|
|
I hope to implement the function like mspaint.exe' s text input. Mspaint has a font toobar, if check the last button on the bar, you can type text from right top to left down.
|
|
|
|
|
Hi, I'm having some issues with Visual Studio 2010; I have suddenly gotten an error while trying to compile a project that compiled fine in Visual Studio 2008.
The errors are:
error C2440: 'initializing' : cannot convert from 'const char [10]' to 'char *'
error C2440: 'initializing' : cannot convert from 'const char [3]' to 'char *'
error C2440: 'initializing' : cannot convert from 'const char [4]' to 'char *'
error C2440: 'initializing' : cannot convert from 'const char [5]' to 'char *'
error C2440: 'initializing' : cannot convert from 'const char [6]' to 'char *'
error C2440: 'initializing' : cannot convert from 'const char [8]' to 'char *'
The errors come from one of Visual Studio 2010's include files called "xmemory". The code the error points to is:
void construct(pointer _Ptr, _Other&& _Val)
{
::new ((void _FARQ *)_Ptr) _Ty(_STD forward<_Other>(_Val));
}
I have done alot of googling but can find nothing to help me with this, except something about Visual Studio 2010 uses nullptr now instead of the number 0. I really need help. I have no idea what is using xmemory or why this is happening.
|
|
|
|
|
Looks like a conflict between the UNICODE and NON-UNICODE character set.
Check if you're passing in a wide character data type to a function expecting an ASCII data type.
|
|
|
|
|
Thanks for your reply. In my project settings, my character set I'm using is Multi-Byte, if thats what you are asking. I believe that is ASCII.
|
|
|
|
|
If you know which line of produces the error in your code, please post that line and the variable declaration affecting that line.
|
|
|
|
|
I do not know which line it is.
|
|
|
|
|
Comment out a section of the code and build it.
Depending on whether it compiles or not, we can determine if the error occurs in that part of the code.
This way you can pin-point the exact line where the error occurs.
You could also change multi-byte to unicode and try to compile, if that is at all possible.
|
|
|
|
|
I switched to unicode and i get the same errors.
|
|
|
|
|
Nah....
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This sounds to me like its coming from an attempt to use a string literal to set up something that is expecting a non-const char *. Since a string literal is const, this is a const violation. Are you setting up 6 items somewhere in your code using 6 string literals of the lengths reported in your error messages?
|
|
|
|
|
Hi
Suppose I have following:
class A
{
}
class B : public class A
{
}
I have an instance of class A "pClassA". can I cast it to class B?
I want an instance of class B from the existing instance class A. How can I get it?
Thanks,
modified on Thursday, January 14, 2010 5:41 PM
|
|
|
|
|
Assuming the inheritance is public (in your sample it is private), you can do something like:
A* a = new B;
B* b = dynamic_cast<B*>(a);
|
|
|
|
|
I have following:
A* a = new A;
B* b = dynamic_cast<B*>(a);; ??????
|
|
|
|
|
Since it is a dynamic cast, a type safety check is incurred at runtime: Add a try catch block and you will know. Alternative answer, if you want an instance of class B you might need to create a new object (if class B has more member variables than class A), a good way to do this could be a specific constructor/assignment operator.
Hope this helps,
M
|
|
|
|