|
Hello
I want to use a vector class
Is there a exemple how to use this
thanks,
aef
|
|
|
|
|
|
Hello,
I would like to know how to use and declare a buffer in the visual c++/cli
because I made a capture TCP/IP (sniffing) but my application was being length (in a networks with very high speed like 100Mbit/s),
to regulate this problem a beffer should be used.
aef
|
|
|
|
|
I need to communicate with a non-windows platform via TCP. The message will be a unmanaged data structure. How can I encode this into a managed type that the Socket.Send command can handle? The message must be decoded on the other platform, which won't have the .NET framework.
|
|
|
|
|
You'd need to create an array of Bytes (for the Socket::Send()) and "serialize" a managed type
into a stream of bytes (representing the structure) in the array.
A couple things to keep in mind:
Structure packing can be different on different languages/platforms. This means you have to
ensure each of the structure's members is at the appropriate offset in the Byte array.
The BitConverter class can help for converting managed base types to a stream of byes,
but you need to deal with byte order (endian-ness) of multi-byte types if the other
platform is different. If this is an issue, multi-byte integer types sould be sent using
network byte order. IPAddress::HostToNetworkOrder() and IPAddress::NetworkToHostOrder()
can do the conversion but the other end needs to know to convert the sent network-order
bytes back to host-order.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi friend's
i want to compute the square root of a number with 15,000,000 digits but i cant use the mathematic functions that already in librarys. so i have to compute this manually.but i don't know the formula of this work.
please help me immediately.
thank you
msma
|
|
|
|
|
To calculate a square root manually, these are the first steps:
- take a large sheet of paper
- write your number in the top left corner
- group the digits by two, form right to left
- figure out the square root of the leftmost group (which holds one or two digits)
- that gives you the first digit of the result
- estimate the second digit by checking if the square is still less than the original
number (using two groups now)
etc.
Good luck.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
How about a slide-rule! Yeah, I am old!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi George,
I am sure the slide-rule is older than all of us, but I doubt it will give
sufficient precision, unless you know of a very special algorithm...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: I am sure the slide-rule is older than all of us, but I doubt it will give
sufficient precision
Actually, he didn't mention anything about precision!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Well, if one does not care much about precision, the answer is 12.
No need for a sheet of paper nor an abacus.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I guest that would work if the number was 144.(followed by 14,999,997 zeroes)! That would satisfy his requirements.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
No, it is a universal solution to a whole class of problems.
It was offered to all CPians by our colleague Malcolm Stuart, who ends a lot
of his contributions by the very good advice: "More functions should disregard
input values and just return 12. It would make life easier."
And I can confirm life is getting easier this way.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Please forgive my ignorance? What is a CPian? Please don't reply with "12".
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi George,
no, if you want a number here, it is well over 4 million, and increasing
all the time.
For a definition, I refer to this week's third tip; Google offers about
1000 hits for CPian, most of them refering to inhabitants of CodeProject.
Unfortunately Wikipedia and MSDN are not up-to-date on this issue.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks, I am now enlightened! I didn't know I was a CPian. Now, I have the smarts to figure out this 1 Billion-lightyear wide void in space that is 10 Billion light years away. Thus, twelve might be a promising number.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
While possibly not directly related to square rooting, your last message
triggers the following intriguing question: how does one measure a void,
and more in particular a void of that size?
And would it be possible to do that without using mathematical functions too?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I've been trying your method since Saturday.
I'm not even close to being done with step 2 (15 million digits)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You mean you found a large sheet of paper that can hold 15,000,000 digits. Imagine the number of pencils and erasers you will consume. Would this qualify for a world's record and finding the square root?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi Mark,
here is a performance optimization for you:
you don't need all the digits to start calculating the square root, so what
you can do is note a few thousand digits, and move on to the next step
and determine the first thousand digits of the root.
Make sure to leave the space for the missing digits though, otherwise you
may have to restart everything later on.
furthermore what's the hurry? the question was not even marked "urgent"
or "somewhat urgent".
Hope you don't make any mistake in the process...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello,
I want to launch a timer starting from a method which one has to declare, because I wants that a thread launches it.
of habitud the timer is launched starting from an event of click of a boutton
how to do it its without having an event of click.
Thank you,
aef
|
|
|
|
|
I am confused about what you want to do?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I have a beginners question. What does the code look like to use DrawLine
in C++ CLI? -- thanks
|
|
|
|
|
Here's one way:
<mshelp:link tabindex="0" keywords="T:System.Drawing.Graphics" xmlns:mshelp="http://msdn.microsoft.com/mshelp">Graphics^graphics = CreateGraphics();
Pen AzurePen(Color::Azure);
graphics->DrawLine(%AzurePen, 10, 10, 50, 50);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|