|
Why not:
strncpy(Date[cyc], (char *)orig, TARGSIZE - 1);
strncpy(Date[cyc], (char *)rec->Fields->GetItem("Time")->Value, TARGSIZE - 1);
I must get a clever new signature for 2011.
|
|
|
|
|
Gentlemen,
I hope everyone is having a good day.
I have an problem with my .dll that is linked to Excel.
I have 2 functions in the file, they are named in the def file and they work fine.
I added a third this morning, added name to def file.
I declared it in VBE.
For some reason, when I try to type it into a cell and give it a variable, i.e. cell formula is =Hs_P(B8),
immediately Excel has an error and shuts down. I am very perplexed.
Any ideas? Have I given enough information?
This is the error Excel is throwing out "Excel asertion error"
And the line from the code _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
I haven't found the problem, but I believe it is the way I am calling one function from inside of another function.
|
|
|
|
|
Assuming you are talking about some C++ code then you may need to use your debugger to find exactly where it is failing. From the information provided above you have an invalid pointer somewhere.
I must get a clever new signature for 2011.
|
|
|
|
|
This function seems to be causing the assertion failure, but I cannot se why, it compiles without error.
I think I found the error, it appears I cannot delete the arrays before I return x, does anyone know this to be true?
delete [] J0;
delete [] n0;
delete [] Ir;
delete [] Jr;
delete [] nr;
return(x);
}
modified on Thursday, January 27, 2011 5:35 PM
|
|
|
|
|
You can't create any memory errors or access violations without destabilizing Excel.
|
|
|
|
|
Having looked at the code in your original message I see the problem. You are instantiating your arrays on the stack by statements such as:
double J0[10] = {0, 1, -5, -4, -3, -2, -1, 2, 3};
and then trying to dispose of them by delete . This is the cause of your problem, you cannot delete a variable that was not created with new . Stack variables will be disposed of automatically when the function returns.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi all,
I have a CFormView, and a child CListCtrl control. I can handle
accelerator events, like Ctrl+C, Ctrl+V ... in CFormView without
problem, by defining below message handler:
ON_COMMAND(ID_EDIT_COPY, &CMyFormView::OnEditCopy)
Now I want my CListCtrl handle these commands differently. I want to
implement OnEditCopy in CListCtrl class, rather than implement logic
in the view class. How can I pass the accelerator events from CView to
child control, when CListCtrl is on focus? I tried like:
ON_CONTROL_REFLECT(ID_EDIT_COPY, &ThisClass::OnEditCopy)
But it does not work.
|
|
|
|
|
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]
|
|
|
|