|
u could get each computer to ping each other computer and then report back, then u get "distances"
bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
1. What do you mean by 'distance' - physical (i.e. miles), or network (i.e. hops) ?
2. If you mean physical then your premise: 'I can easily evaluate the shortest path between 2 computers if I know how to calculate the distance between 2 computers' is incorrect.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks for replay
I actually want to calculate the best path for sending information from one computer to another.
What I am trying is :
I am trying to build a network where several servers will be distributed to in a wide area. The purpose of these servers will be to deliver fax. I require calculating the best path for this purpose. Actually this is a final year project.
vikram
|
|
|
|
|
Then do a search for a network 'trace' implimentation.
e.g. Search on keywords: network trace route c++
...cmk
Save the whales - collect the whole set
|
|
|
|
|
i made one program in MFC(VC++). i want to give security to my program . i want that if i install my program on one pc. it cannot run on another pc. so i want to use hard disk serial number in my program. but i dont know how to get hard disk number in vc++
plz tell me if any other method to secure my program
|
|
|
|
|
Look for [GetVolumeInformation] which return Drives Serial Numbers.
if you really need HarDisk Serial Number I believe you have to Program Using WMI(Window Management Instrumentation.)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
i am not able to use getvolumeinformation in my vc++ code.
can u give me one example how to i use getvolumeinformation in my code
|
|
|
|
|
iam using Doc - View architecture for an MDI application.
I need to implement zoom-in & zoom-out functionality for the child windows within the application.
Iam not using any CScrollView class.All i have is the default View class that is generated by the application.
can anyone let me know the procedure.
thanx in advance
laiju
|
|
|
|
|
What are you showing in your view ? I believe you can set scaling on a DC, that's probably the way to go, if you override OnPaint and set the DC up so that the rest of the painting that takes place will be drawn at a larger than usual scale.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
IAM drawing rectangles, bitmaps and displaying text on the client area .I want to zoom these .
laiju
|
|
|
|
|
Then do what I said. The other person who replied told you exactly what I was trying to remember.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Try using:
SetMapMode(dc, MM_ISOTROPIC);
then,
SetWindowExtEx(), SetViewportExtEx().
...cmk
Save the whales - collect the whole set
|
|
|
|
|
UpdateData (1);
for(int m=1;m<=m_edit1.GetLength ();m++)
{
CString tr=m_edit1.Left (m);
tr.Delete (0,m-1);
ch=tr.GetAt (0);
tr.Format ("%d",ch);
data =(double)ch;
//calculate ((data)^e mod n) .i.e the remainder
c=0;d=1;
for(i=k;i>=0;i--)
{
c=2*c;
d=fmod(d*d,n);
if(bits[NO_BITS-i] == '1')
{
c=c+1;
d=fmod(data*d,n);
}//end of IF
}//end of for loop
int a,b;
// char buffer[50];
CString s=_fcvt(d,0,&a,&b);
if(s.GetLength()<2)
{
s.Insert(0,"00");
}
else if(s.GetLength()>1&&s.GetLength()<3)
{
s.Insert(0,'0');
}
UpdateData (1);
m_edit6 +=s;
UpdateData (0);
this is a code for encryption .here first i converted the string in the edit box 1 to its corresponding ascii value.after that i found the double value for that.for concatenating the values, i converted the double value into string&i stored that value into m_edit6.
for decryption i have to convert that string value in the edit6 to double using "strtod()".
plz help me with this..
|
|
|
|
|
nehathoma wrote:
for decryption i have to convert that double value in the edit6 to string using "strtod()".
Well, that's just plain impossible. strtod converts a string to a double, not a double to a string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
sorry ,actually i meant string to double conversion.
|
|
|
|
|
if you want to convert string to double use this:
CString string;
char *temp;
double dNumber;
temp = string.GetBuffer(string.GetLength());
sprintf(temp,"%f",dNumber);
Eli
|
|
|
|
|
eli15021979 wrote:
CString string; <br />
char *temp; <br />
double dNumber; <br />
temp = string.GetBuffer(string.GetLength()); <br />
sprintf(temp,"%f",dNumber);
Well, using your code exactly as shown is incorrect because [1] the string has no contents, so calling CString::GetLength() to size the returned buffer is incorrect, [2] you did not call CString::ReleaseBuffer() to relock the written-to buffer, and [3] you did not enforce the length of the data written to the buffer (memory overrun potential).
(Mis)using CString :
<br />
CString string; <br />
char *temp = string.GetBuffer( 32 + 1 ); <br />
double dNumber = 12345.54321; <br />
<br />
_snprintf( temp, 32, "%f", dNumber );
temp[ 32 ] = '\0';
string.ReleaseBuffer();
You will want to add proper exception handling and testing of the pointer returned by CString::ReleaseBuffer() .
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Don't you think he should try to do the work by himself?????
I just wanted to give him general direction.
BTW:
I just realized that he wanted convertion from string to double(i.e this wasn't the suitable example) so :
CString string = "1234.5678";
char *temp;
double dNumber;
temp = string.GetBuffer(string.GetLength());
sscanf(temp,"%f",dNumber);
<big>string.ReleaseBuffer();:laugh:</big>
Regards,
Eli
|
|
|
|
|
eli15021979 wrote:
Don't you think he should try to do the work by himself?????
I just wanted to give him general direction.
Given general direction is fine, but at least give proper direction; do not lead someone down a path that will cause them problems in the future.
-And, actually, your example is wrong, too...!
You need to pass the address of dNumber to sscanf(...) . Better to use a function designed for this specific purpose, like strtod(...)/_tcstod(...) instead of a more general purpose function, like sscanf(...) .
Calling GetLength() in the context shown above will still return an incorrectly sized buffer.
<br />
double dNumber1 = ::_tcstod( _T( "1234.5678" ) ); <br />
double dNumber2 = ::strtod( "1234.5678" ); <br />
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Is google broken on your PC ? I've answered this question a few times lately ( I assume you're asking over and over, or all your class is looking for help on the same assignment ) and I've just been cutting and pasting the demo code from the first match google hits.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Here is
char *t;
double dt=::strtod(m_edit6,&t);
CString str;
//check is we got correct double value
str.Format("%e",dt);
MessageBox(str);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
how can i convert this double value into its corresponding ascii value??
|
|
|
|
|
|
hello,
i write a service and do something,but what can i do to not allow others to stop my service or modify the start type,status of the service?who can help me?
best regards
|
|
|
|