|
Have a look here[^], I'm not sure if it's posted by you as well (exact same wording of the question), but it appears to have been answered to the poster's satisfaction.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
how we write the c-program of sorting the set of point. w.r.t. convex polygon
|
|
|
|
|
how we write the c-program of sorting the set of point. w.r.t. convex polygon
|
|
|
|
|
Uh, what ?
Could you please explain your problem in more details so that we can understand what you are looking for ?
What is your problem exactly ? What did you try yet ? Where are you stuck precisely ? ...
|
|
|
|
|
Why don't you try to explain better your requirements instead of reposting (and cross-posting) your question?
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]
|
|
|
|
|
Do you have the skills necessary to write a C program? If the answer is yes then you can use the simple or STL sort[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Like others already pointed out, your request is rather unspecific. You mention sorting, a 'set of point(s?)' and a convex polygon. What are the predefined parameters of the problem, how do they relate to each other, and what, exactly, is the desired end result?
Just out of interest (about google more than your question) I've put the above terms into google and one of the first useful results is Arrange points so polygon is not self intersecting.
Is this what you try to achieve?
|
|
|
|
|
I test MFC classes to download files from internet server , but how can I upload it ? Can I use the same classes / tehnique ?
|
|
|
|
|
mesajflaviu wrote: Can I use the same classes / tehnique ?
Most likely, but since you did not show any specifics on how you were downloading, we can't say with any certainty.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Ok , here is my download code , which goes perfectly :
( I don't know if is corectly , but does function )
BOOL CMyDoc::GetXmlFile(CString sAddress, CString& sResult)
{
CString sTemp;
CInternetSession ISession;
CInternetFile* pIFile = NULL;
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
try
{
pIFile = (CInternetFile*)ISession.OpenURL(sAddress);
while(pIFile->ReadString(sTemp))sResult += sTemp;
pIFile->Close();
delete pIFile;
}
catch(CException* pException)
{
delete pIFile;
pException->GetErrorMessage(sTemp.GetBuffer(255),255);
sTemp.ReleaseBuffer();
pFrame->SetMessageText(sTemp);
return FALSE;
}
return TRUE;
}
I will be very glad if you can help me . Thank you very much !
|
|
|
|
|
So then can't you just use WriteString() to upload the file?
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
David , you are very prompt ! Thank you ! But , if I need to upload an file , don't need an login data to access upload server ?
|
|
|
|
|
mesajflaviu wrote: But , if I need to upload an file , don't need an login data to access upload server ?
Maybe, maybe not. Only you will know that level of detail. You might look into CHttpFile::SendRequest() .
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Maybe ( or for sure ) I don't understand something : I have an address to an server : 'http://www.testserver.com/testfolder/' and in this location ( path ) I want to upload an PC local path file :
'D:/Flaviu/test.txt' ... How can I adapt download code from above to write strings into server file ? First , create an mirror text file on server , and there write strings from PC local txt file ?
|
|
|
|
|
I found the solution , and for those hwo have the same issue , I post the code :
BOOL CMyDoc::UploadFile(CString sFileName)
{
CString sTemp;
BOOL bRet = FALSE;
CInternetSession session;
CFtpConnection* pConn = NULL;
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
sTemp = sFileName.Right(sFileName.GetLength() - sFileName.ReverseFind('\\') - 1);
try
{
pConn = session.GetFtpConnection(_T("ftp.domain.com"),_T("username"),_T("password"),INTERNET_INVALID_PORT_NUMBER,TRUE);
bRet = pConn->PutFile(sFileName,_T("./httpdocs/temp/") + sTemp);
}
catch(CException* pException)
{
pException->GetErrorMessage(sTemp.GetBuffer(255),255);
sTemp.ReleaseBuffer();
pException->Delete();
pFrame->SetMessageText(sTemp);
}
if(pConn)
{
pConn->Close();
delete pConn;
}
return bRet;
}
|
|
|
|
|
Hi all,
i m working on vc++ and i have no idea of vb,i saw a vb application and want to do same functioning in my vc++
these are some function please help me to convert it in vc++
Shared Function Encode7Bit(ByVal Content As String) As String
'Prepare
Dim CharArray As Char() = Content.ToCharArray
Dim c As Char
Dim t As String
For Each c In CharArray
t = CharTo7Bits(c) + t
Next
'Add "0"
Dim i As Integer
If (t.Length Mod 8) <> 0 Then
For i = 1 To 8 - (t.Length Mod 8)
t = "0" + t
Next
End If
'Split into 8bits
Dim result As String
For i = t.Length - 8 To 0 Step -8
result = result + BitsToHex(Mid(t, i + 1, 8))
Next
Return result
End Function
Shared Function CharTo7Bits(ByVal c As Char) As String
If c = "@" Then Return "0000000"
Dim Result As String
Dim i As Integer
Dim ij As Integer
For i = 0 To 6
ij = Asc(c)
If (Asc(c) And 2 ^ i) > 0 Then //how write it in vc++
Result = "1" + Result
Else
Result = "0" + Result
End If
Next
Return Result
End Function
Shared Function BitsToHex(ByVal Bits As String) As String
'Convert 8Bits to Hex String
Dim i, v As Integer
For i = 0 To Bits.Length - 1
v = v + Val(Mid(Bits, i + 1, 1)) * 2 ^ (7 - i)
Next
Dim result As String
result = Format(v, "X2")
Return result
End Function
Shared Function EncodeUCS2(ByVal Content As String) As String
Dim i, j, v As Integer
Dim Result, t As String
For i = 1 To Content.Length
v = AscW(Mid(Content, i, 4))
t = Format(v, "X4")
Result += t
Next
Return Result
End Function
thanks in advance
modified on Thursday, January 27, 2011 5:24 AM
|
|
|
|
|
Why don't you start yourself by going line by line? All what I see are only 'Dim' and 'For' statements you need to parse. In VB 'Dim' is to declare a variable.
|
|
|
|
|
What do you really need to do?
Might be easier coding directly your C++ functions (i.e. based just on requirements) instead of mimic the ugly VB .
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]
|
|
|
|
|
|
Conceptually you should not try to do this. If you want to create a button in WIN32 application you should see the CreateWindow API
I am a HUMAN. I have that keyword in my name........
_AnsHUMAN_
|
|
|
|
|
CButton is a MFC class, so you can't use it in a Win32 without MFC. You will need to create a MFC project if you want to use it.
|
|
|
|
|
You shouldn't.
In other words, you need MFC in order to use a CButton , but, do you really want to bloat with MFC your neat Win32 application just for using CButton ? You may use plain Win32 API function for dealing with buttons.
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]
|
|
|
|
|
hi friends,
i have have a MDI Application. when i close a document using onclosedocument. my document handle remains active though the members used in document are set to null. so i cannot check this condition
if(doc)
as it returns true. whereas in the if block it cannot access the members so app crashes
eg.
<pre>
if(doc) //handle =FAEX000
{
doc->getprivatevariable_or_functions(); // the application crashes here
}
</pre>
thanking in anticipation
REgards
Samir
|
|
|
|
|
How did you allocated the "document" ? I mean how did you create the pointer doc (it seems it is a pointer, right?).
When you release your document (for instance by deleting the memory), you also always have to assign null to it, so that you can check whether it has been deallocated. If you do that, then your code will work properly (the if segment won't be entered since doc is NULL).
|
|
|
|
|
You may override CDocument::OnCloseDocument for marking your document as invalid (you may set a custom property for the purpose) and then check for document validity before any access.
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]
|
|
|
|