|
maheen zahra wrote: please send me topics
Financial markets.
maheen zahra wrote: <layer> or data
Get it off CNBC.
maheen zahra wrote: that are related to loops&functions
while(stillstupid || stilllazy)
{
buybook(*dollars);
readbook(*brain);
understand(*hardwork);
)
makemoney(*moredollars);
How is that?
==============================
Nothing to say.
|
|
|
|
|
What about in assembly?
|
|
|
|
|
move edi edi
pop ebp esi
pop ebp+4 esx
pop ebp+8 edx
cmp esx edx
jne life + 32
push *dollars
call buybook
etc etc etc
(actually, thats a load of crap, but I dont write assembly, I just have to understand it )
==============================
Nothing to say.
|
|
|
|
|
|
thank you about infomations
|
|
|
|
|
Great answer! 5+
I'm not really sure that the read function call will work though. I have this feeling the parameter will cause a null pointer exception.
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Even better answer 5!
==============================
Nothing to say.
|
|
|
|
|
Hi,
I Replied. What were you going to do if I didn't??( Or of nobody Did?)
Shoot all those that did not reply?? This community is not one of little slaves kept locked up until you issue a demand for information!
Please read the Posting notes before you ask a question on this forum!
Bram van Kampen
|
|
|
|
|
<>&<a href=""></a><a href=""></a>[<a href="" target="_blank"></a>]
|
|
|
|
|
Your question only contains some tags.
Please edit your question.
0100000101101110011001000111001011101001
|
|
|
|
|
Hi everyone,
Have a nice day, please help me following concern
I know that, Function pointer in C++ can point to an address of global function, or static public function of a class
For example:
typedef float (MyFunction)(float a, float b);
//Global function
float add(float a, float b)
{
return a+b;
}
Class Math
{
public static float add(float a, float b)
{
return a+b;
}
}
void main(char*args[])
{
MyFunction*fp;
//Point to global function
fp = add;
printf("%f",fp(1,2))
//Point to public static function
fp = Math::add;
printf("%f",fp(5,10));
}
But it can not point to address of a function of a specified object.
For example, function add in calss Math is not static
Class Math
{
public float add(float a, float b)
{
return a+b;
}
}
The following is impossible (compile error)
void main(char*args[])
{
MyFunction*fp;
//Point to public function of specified object instance
Math*m = new Math();
fp = m->add;
printf("%f",fp(5,10));
}
But it is the thing i really want. Because i want to know function add is executed in context of what object (in this case we can know it is object m).
Above example is something like the concept Delegate in .NET.
Is there any design pattern to make such a delegate for C++?
Thanks,
Tin,
|
|
|
|
|
|
Class Math <--- error
{
public float add(float a, float b)
{
return a+b;
}
}<--- error
Firstly , lowercase. Class Math should be class Math
secondly , semicolon
|
|
|
|
|
I build application using visual studio 2005 in release mode without MFC. but I need to
install vc2005 run time to run the application . is there any settings in visual studio so
that without installing vc2005 run time I can run my application .
Trioum
|
|
|
|
|
You can link your application with static copies of the library rather than the shared DLL copies. There is a setting for the linker to do this.
Remember that linking statically increases the size of your EXE / DLL because all the required C Runtime Library and MFC / ATL libraries are included in your application. Of course, this is the tradeoff you make when you decide to not include the VS2005 redistributables in your kit / installation package.
|
|
|
|
|
Where I found this setting
Trioum
|
|
|
|
|
Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library .
Set this to /MT and /MTd for Release mode and Debug mode respectively.
|
|
|
|
|
It is already set , if I installed vcredist_x86.exe then exe run , if uninstall then exe do not run .
i am using Use Standard Windows Libraries in release mode
Trioum
|
|
|
|
|
Besides the setting for the C RTL (/MT etc...) you also need to check the Configuration Properties -> General for the "Use of MFC" and "Use of ATL". Both of those have a selection for "in a static library". The default to "use standard windows libraries" which means "shared DLL".
I use VS2008 but I think they are in the same place in VS2005
|
|
|
|
|
You don't HAVE to install visual studio, there's probably some dependencies that you need to distribute along with your application so that it'll be complete. Use a tool like Dependency Walker[^] to figure out what libraries you may be missing. You can then either include those libraries in your distribution OR build them into your executable statically (depending on what libraries you may be missing).
|
|
|
|
|
I copied some sample code from msdn to create a socket, and modified it for testing. I want to broadcast a udp dgram, but I cant figure out what to send. I'm using ethereal to examine what SQL Management sends, and I'm trying to copy the behavior. So it looks like my first send is accurate, but I'm not sending the correct data out for a response back from sqlbrowser. I'm convinced if I send the right stuff, I will get my responses back from all the SQL servers. If i'm in the wrong forum sorry, didn't really know where to post it.
I tried 0x02 in the send buffer.
iResult = getaddrinfo(
"255.255.255.255",
"ms-sql-m",
&hints,
&result
);
I think this is what SQL Management sent
0000 ff ff ff ff ff ff 00 13 72 36 67 30 08 00 45 00 ........ r6g0..E.
0010 00 1d 6f 9a 00 00 80 11 07 8a c0 a8 03 04 ff ff ..o..... ........
0020 ff ff 05 8b 05 9a 00 09 2f 0b 02 ........ /..
And this is what I sent
0000 ff ff ff ff ff ff 00 13 72 36 67 30 08 00 45 00 ........ r6g0..E.
0010 00 22 8c 51 00 00 80 11 ea cd c0 a8 03 04 ff ff .".Q.... ........
0020 ff ff 06 bc 05 9a 00 0e 9c 8f 30 78 32 66 30 62 ........ ..0x2f0b
|
|
|
|
|
Since you got no error messages..
Gee, im not sure.. could you please post more of your code?
look here for hints.
|
|
|
|
|
I hard coded the value for experimenting, The sample code I'm using is for sending text like requesting a web page from a server, and I think I need to send hex code, so I'm going to try and figure out how to send data in a different format. I think the other article in Code Project is correct, in which I need to send 0x02. The szSendBuf is where I place the data.
char* szSendBuf = "STX";
char recvbuf[DEFAULT_BUFLEN];
int iResult;
int recvbuflen = DEFAULT_BUFLEN;
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != 0) {
printf("WSAStartup failed with error: %d\n", iResult);
return 1;
}
ZeroMemory( &hints, sizeof(hints) );
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
iResult = getaddrinfo(
"255.255.255.255",
"ms-sql-m",
&hints,
&result
);
if ( iResult != 0 ) {
printf("getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
}
for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) {
ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
if (ConnectSocket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}
iResult = connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
if (iResult == SOCKET_ERROR) {
closesocket(ConnectSocket);
ConnectSocket = INVALID_SOCKET;
continue;
}
break;
}
freeaddrinfo(result);
if (ConnectSocket == INVALID_SOCKET) {
printf("Unable to connect to server!\n");
WSACleanup();
return 1;
}
iResult = send(
ConnectSocket,
szSendBuf,
(int)strlen(szSendBuf),
0
);
|
|
|
|
|
Is that what's in the UDP data portion of the packet (not sure where UDP header ended and your data started)? If so, then you can just make a buffer that has the same exact data, shouldn't be hard just do something like:
const char RequestBuffer[] = {0xff,0xff,...,0x02}
...then just send that... except, if you're not really sure what's being sent, you may not get exactly what you're expecting... there's probably an API that defines the interactions between a "SQL Manager" and other SQL servers. If you're trying to create an application that simulates a manager, you should probably find whatever standard defines those interactions and implement that instead of just trying to blindly copy a data packet.
Good luck.
|
|
|
|
|
I know the basics, 8 bit makes a byte, and so forth, but I can't read the code I posted. I am however getting better at using the ethereal, and highlighting the portions of the transmission, such as data.
The data being sent seems to be just 1 byte, with a value of 02, and is represented as a dot .
I was thinking last night that perhaps instead of sending a char, like you would use to request a web page, I need to send a bytes.
|
|
|
|