|
englobe parameters with ""
xcopy ".\MyPatchJ\bin\MyApp.exe" "c:\Program Files\"
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
ok.. thanks.. i'll try that?
|
|
|
|
|
of course, why wouldn't you ? are you suspecting something ?
of course, don't if you don't want to copy into program files...
i just gave you the tip to work on dos with spaced parameters...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 11:07 Tuesday 6th September, 2005
|
|
|
|
|
You can use quotes as has already been suggested, use the 8.3 format of that folder without quotes, or use CopyFile() instead.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Could someone clear up a possible memory leak for me? In using ADO.NET in MFC Projects it is written:
#pragma push_macro("new")
#undef new
try
{
m_OleDbConnection = new OleDbConnection(
S"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\test.mdb"
);
m_OleDbConnection->Open(); // Open up the connection
m_OleDb = new OleDbCommand(S"select * from Persons", m_OleDbConnection);
m_Reader = m_OleDb->ExecuteReader();
int count = 0;
while (m_Reader->Read())
{
AddToList(count,m_Reader->get_Item("First Name")->ToString(),
m_Reader->get_Item("Last Name")->ToString(),
m_Reader->get_Item("Phone Number")->ToString()
);
count++;
}
}
catch(Exception *e)
{
AfxMessageBox(CString(e->ToString()));
}
__finally
{
m_Reader->Close();
m_OleDbConnection->Close();
}
#pragma pop_macro("new")
What is bothering me is there is a new with no delete. The most surprising one is m_OleDb which doesn’t even have a close, let alone a delete. I tried adding a close as well as a delete and neither was accepted by the compiler.
I open and close the database hundreds of times, so I wanted to consider leaving it open and then I started to think about the memory leak problem.
Can anyone give me a hint why a memory leak doesn’t seem to play here?
Thanks,
Ilan
|
|
|
|
|
Would it make sense to add the following below the call to ExecuteReader() :
delete m_OleDb; since m_OleDb is not used any more?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
It made so much sense that I already tried it.
The compiler refuses with the error message:
c:\Ilan\ctview\ReadStudy.cpp(1755): error C3841: illegal delete expression: managed type 'System::Data::SqlClient::SqlCommand' does not have a destructor defined
Therefore I wanted to see if anyone had any other ideas.
Thanks,
Ilan
|
|
|
|
|
|
My bad. I've not used .Net so my new/delete suggestion was apparently way off base.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
is there a way in C++ to get the ethernet address of a local machine running any of the MAC OS?
Rola
|
|
|
|
|
Technically, no. C++ knows nothing of IP addresses or the like. The API to obtain that type of information will likely be platform specific. For Windows, the information can be obtained with gethostname() followed by gethostbyname() , neither of which are C++.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Both gethostname() and gethostbyname() are part of the Berkley Sockets package which is the basis for most TCP/IP sockets implementations - so any OS that supports a Berkley Sockets implementation should have these calls.
Steve
|
|
|
|
|
Hi,
I am trying to create AES encryption and decryption separately. For that I have created two programs one does the encryption and one does the decryption. After the encryption, encrypted value is stored inside the database, later it is retrieved and passed as a parameeter to the decryption program.
The problem is that encrption works perfectly, but decryption is not.
here is the corresponding code snippets
ENCRYPTION
*****************************************************************************
pRequest->Write( "Hello from CFX_AES1!" ) ;
LPCSTR lpszVariable = pRequest->GetAttribute("outvar");
LPCSTR lpszEStr = pRequest->GetAttribute("eString");
LPCSTR lpszKey = pRequest->GetAttribute("key");
try
{
CRijndael oRijndael;
oRijndael.MakeKey(lpszKey, CRijndael::sm_chain0, 16, 16);
char szDataIn1[8000];
strcpy(szDataIn1,lpszEStr);
char szDataIn[8000];
char szDataOut[8000];
memset(szDataIn, 0, 8000);
memset(szDataOut, 0, 8000);
// Test ECB
strcpy(szDataIn, szDataIn1);
memset(szDataOut, 0, 8000);
oRijndael.Encrypt(szDataIn, szDataOut, 8000, CRijndael::ECB);
pRequest->SetVariable(lpszVariable,szDataOut);
}
****************************************************************************
DECRYPTION
****************************************************************************
LPCSTR lpszVariable = pRequest->GetAttribute("outvar1") ;
LPCSTR lpszEStr = pRequest->GetAttribute( "dString" );
LPCSTR lpszKey = pRequest->GetAttribute("key");
try
{
CRijndael oRijndael;
char szDataIn[8000];
char szDataOut[8000];
oRijndael.MakeKey(lpszKey, CRijndael::sm_chain0, 16, 16);
strcpy(szDataIn,lpszEStr);
//Test ECB
memset(szDataOut, 0, 8000);
oRijndael.Decrypt(szDataIn,szDataOut,8000, CRijndael::ECB );
pRequest->SetVariable( lpszVariable,szDataOut );
}
****************************************************************************
Thanks in advance,
mustangnet
|
|
|
|
|
Is there a way to use AA with MFC? I've created a skin system for my little app, and now I've added support for irregulary shaped skins, but they don't render quite as nice, I think AA would do the trick.. I don't want to link to DirectX or anything like that, my app needs to stay as small as possible..
Any ideas, thoughts..?
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
look over the internet for graphics gems books in pdf format and u have there everithing you need...
NG
|
|
|
|
|
Do you mean graphics gems for graphics editing or programming? I'm talking about rendering the image on the screen and beautifying the edges, where transparency begins
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
for programming....
NG
|
|
|
|
|
I'm poking google's eye right now, but all I get is GPU gems, photoshop gems etc..
Perhaps you know a good starting link?
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
use emule, download it from www.download.com
|
|
|
|
|
Hi all
When I am trying to delete a COblist list , I get the following assertion
_CrtIsValidHeapPointer fails with the message
Debug assertion failed! in dbgheap.c
The code is below
while(!WzdMsrTable.IsEmpty())
delete WzdMsrTable.RemoveHead()
MSDN says this function _CrtIsValidHeapPointer checks if the block of data is in the local heap or not .
How can this list WzdMsrTable be not-in-local-heap ?
MSDN also says the function _CrtIsValidHeapPointer is not called during Release mode.
Now my question is
1) Why the function _CrtIsValidHeapPointer fails
2) If this function is ignored in release mode , what is the impact of it in the execution . I am asking this becasue , there are some random crashes even during Release mode due to the code segment involved here .
Any one to help me ?
redindian
|
|
|
|
|
NEVER ignore problems like this. Your software has bugs and until you know what the bugs are, you can make NO statements as to the impact of ignoring them.
Check for double deletions. Are you deleting that memory multiple times.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Its not double deletion . In fact I dont understand how a variable's memory can not belong to local heap . And how to get rid of this problem . There is no problem in release exe but I suspect this error is the cause of random crashes in the App
redindian
|
|
|
|
|
I recently installed VS.NET and wanted to create a C++ program, I selected Win32 Console Project to start with. I have one while loop and one for loop. The while loop execute first then follow by the for loop. The problem is after executing the while loop, it closes the window with the black background and will not show me the result. I'd checked my program, it actually run the for loop but the window just close before it can show me anything. This is my test code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int myArray[100];
int count = 0;
int number = 0;
cout << "Please enter some number (-1 to terminate): " << endl;
while (number != -1) {
cin >> number;
myArray[count] = number;
count++;
}
cout << "The numbers you just typed are: ";
for (int counter = 0; counter < count; counter++)
{
cout << myArray[counter] << " ";
}
cout << endl;
return 0;
}
Thanks to anyone that can help me with this so I can start practising my programming skill =)
Jay
|
|
|
|
|
I'm not completely sure, but you might try adding this just before return 0;
#ifndef _DEBUG<br />
cout << "\n\n\tPress any key to continue\n\tor any other key to quit..";<br />
getch();<br />
#endif //_DEBUG
Good luck with programming
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
Thanks for the reply, I'd tested it, the problem is still the same, really don't understand why this is so complicated compare to Visual C++ 6.0
|
|
|
|