|
Hi,
Thank you for your answer.
Is there in the forum possibly an example which I could look at myself the thing times?
Best regards
|
|
|
|
|
I want to use VC++ *.lib into C# application. I know that I must compile the lib in to a dll. How can i do that? Any method and hits to me.
|
|
|
|
|
IMO, the easiest way is to create a DLL that exports functions that simply call the .LIB functions:
BOOL __stdcall fooFunc_DLL(int p)
{
return fooFunc_LIB(p);
}
that way, you don't have to change the .LIB functions, and the DLL is a simple one-step pass through.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I suggest you start reading here[^] in the MSDN about DLL's. In order to use your object library (the .lib file) as a DLL, you may need to create a DllMain function in a .C or .CPP source file, compile it, and link it to your .lib.
You will need to research further what it takes to use a DLL from C#; that's something I don't know about.
By the way: I don't know who the two boneheads were that rated your post a 1. I think your question is valid, asked politely, and in the correct forum. Good luck.
Software Zen: delete this;
|
|
|
|
|
Hi
I am using SQL Server for my database programming using CRecordset. but now i have to use Oracle. I am connecting to Oracle using ODBC. How to access tables from Oracle. Tables having BLOB datatype fields. how to access Oracle through VC++. Can u plz guide me.
Thanks in advance.
|
|
|
|
|
Hello,
You can use CDatabase and CRecordset classes for accessing the database and retrieving the records from Oracle. While passing any query when you mention the table name is sufficient, as the ODBC will be connecting to the whole of the database and tables are part of the database.
If the reply helps you, Don't forget to rate it.
|
|
|
|
|
the code below is weirld casue when the change is mutiple by 100(0.67 * 100)
it change to 66 please heplp me solve this
#include iostream
using namespace std
int bugger;
float change=0.67;
int moeny[6][2];
int cointo[6];
float cash;
bugger = (float)change * (float)100;
cout<< "change2: "<<bugger<<endl;
while(bugger !="0" &&="" cash="" if(bugger="">= 100 && money[0][1] !=0)
{
money[0][1]--;
bugger=bugger-100;
cointo[0]++;
cout<< "bugger: "<<bugger<<endl;
}
="" else="" if(bugger="">= 50 && money[1][1] !=0)
{
money[1][1]--;
bugger=bugger-50;
cointo[1]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 20 && money[2][1] !=0)
{
money[2][1]--;
bugger=bugger-20;
cointo[2]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 10 && money[3][1] !=0)
{
money[3][1]--;
bugger=bugger-10;
cointo[3]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 5 && money[4][1] !=0)
{
money[4][1]--;
bugger=bugger-5;
cointo[4]++;
cout<< "change: "<<bugger<<endl;
}
="" else="" if(bugger="">= 1 && money[5][1] !=0)
{
money[5][1]--;
bugger=bugger-1;
cointo[5]++;
cout<< "change: "<
|
|
|
|
|
'int moeny[6][2]' (money after) is not initialized ...
'int cointo[6]' is not initialized ...
'float cash' is not initialized ...
before using.
|
|
|
|
|
this is only a part of the code the problem wit this code is that when then chagne is store in the bugger it always change example((bugger)6.7 = (change)6.6) it always change to a diferant number so can please tell me why please
|
|
|
|
|
You get this problem because of the way floating point numbers are represented, and the way types are converted.
When you convert a float to an integer, for example in the statement:
bugger = (float)change * (float)100;
the float is truncated (i.e. the fractional part is discarded.)
When you multiply two floats (eg 0.67 by 100.0), the answer will not be exactly an integer (eg. 67) - it will be slightly more or slightly less. Since the result you get after truncating is 66, this implies the float representation is less than 67, i.e. 66.9999 . . . Truncating 66.99999 gives 66.
The solution - add some small number to the result before truncating, as below
bugger = (float)change * (float)100 + 0.0001;
|
|
|
|
|
|
I had been taught not to use goto or switch. However a lot of professional code uses both.
Is the switch statement any faster than a lot of if anf else if's? In other words, is switch the same thing as a lot of if else ifs from a machine code point of view?
|
|
|
|
|
I agree it's a good idea to avoid goto, but in my opinion there are correct applications for switches and I would not be surprised to see them in professional code.
I doubt there is much difference between if's and switches in terms of speed. I think the main issue is clarity. The switch is just easier to read if there are a lot of states to be tested.
Best Regards
Cliff
-- modified at 5:11 Sunday 4th September, 2005
|
|
|
|
|
With today's compilers, switches and ifs can perform about the same. You will often find that a compiler will convert a switch statement to a series of ifs and maybe even visa-versa.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
While there may be a valid use for goto , I've not used it in years. You can always organize your code so that it isn't necessary, and the modified code is almost invariably more robust.
I am curious. Why were you taught to not use switch ? While it can be misused, overall it has its applications. Any time you have a discrete value (an enum , for example) that specifies an action, a switch statement is appropriate.
The object-oriented programming crowd would argue that you should create a class structure, and derive unique classes for each case. That approach is inefficient and overkill a lot of the time. It also makes it a lot more difficult to follow program logic.
Software Zen: delete this;
|
|
|
|
|
I agree. Thanks for your response.
|
|
|
|
|
////////////////////////////func A: App's member function ////////////////////////////////////////////////////
newIndex = pRWapp->GetEmptySocket();
if ( newIndex != -1 )
{
myOver = &(pRWapp->m_clientStructArray[newIndex]);
SOCKADDR_IN clntAddr;
int addrLen = sizeof(clntAddr);
myOver->socket = accept( pRWapp->m_serverSocket, (SOCKADDR*)&clntAddr, &addrLen );
if(pRWapp->m_bKillThreads==TRUE)
{
return 0L;
}
if(myOver->socket == INVALID_SOCKET)
{
// this area left out...for shortness
}
memcpy(&(myOver->clntAddr),&clntAddr,addrLen);
if ( myOver->socket != INVALID_SOCKET )
{
user = newIndex * 2;
ZeroMemory( &(myOver->recvOverlapped.Overlapped), sizeof(OVERLAPPED) );
ZeroMemory( &(myOver->sendOverlapped.Overlapped), sizeof(OVERLAPPED) );
CreateIoCompletionPort( (HANDLE)(myOver->socket),
pRWapp->m_gCompletionPort, DWORD(myOver), 0 );
myOver->recvOverlapped.wsabuf.buf = myOver->recvOverlapped.buffer;
myOver->recvOverlapped.wsabuf.len = BUFSIZE - 1;
==> this Func A 's function is to save data to m_clientStructArray[]....
////////////////////////////func B : App's member function ////////////////////////////////////////////////////
CPortClientScks* pPortCliSkc = new CPortClientScks;
pPortCliSkc->sockHandle = m_clientStructArray[index];
m_XXX_Port_SockList.AddTail(pPortCliSkc);
==> func B 's function is to save m_clientStructArray 's content to m_XXX_Port_SockList....
////////////////////////////func C: App's function////////////////////////////////////////////////////
POSITION sndXXXPos ;
sndXXXPos = m_XXX_Port_SockList.GetHeadPosition();
CPortClientScks* pSndXXXSck = NULL;
while(sndXXXPos != NULL )
{
pSndXXXSck = (CPortClientScks*)m_XXX_Port_SockList.GetNext(sndXXXPos);
if(m_pSndXXXSck->sockHandle.ID != "")
{
DWORD sendbytes;
strncpy(pSndXXXSck->sockHandle.sendOverlapped.wsabuf.buf,(LPCTSTR) pByte, bytes);
pSndXXXSck->sockHandle.sendOverlapped.wsabuf.len = bytes;
WSASend( pSndXXXSck->sockHandle.socket, &(pSndXXXSck->sockHandle.sendOverlapped.wsabuf),1,
&sendbytes, 0, &(pSndXXXSck->sockHandle.sendOverlapped.Overlapped), NULL );
}
}
//////////////////////////// following three lines are added to last of func C to check out the content of m_XXX_Port_SockList /////////////////////
sndXXXPos = m_XXX_Port_SockList.GetHeadPosition();
if(sndXXXPos != NULL)
pSndXXXSck = (CPortClientScks*)m_XXX_Port_SockList.GetNext(sndXXXPos);
==> func C' function is to look over m_XXX_Port_SockList's content...
and the structure of SOCKHANDLE IS....
typedef struct _MYSOCKHANDLE
{
SOCKET socket;
char ID[MAX_ID_LEN];
SOCKADDR_IN clntAddr;
MYOVERLAPPED recvOverlapped;
MYOVERLAPPED sendOverlapped;
}SOCKHANDLE, *LPSOCKHANDLE;
this SOCKHANDLE structure is used at m_clientstructArray[], and m_xxx_port_sockList's node member
the problem of this my code is that Getnext returns different value at second GetNext at added 3 lines especially after comed out of func C 's while loop....
but pPortCliSkc's value returned from func B 's new has proper value....
but, func C 's added GetNext return another value.....
why this happens?
GetHeadPosition 's return value is always same but
GetNext value is different , inside of Fucn C's while loop first entered,
but come out of while loop and added Getnext's return value is different ?
why?
please help me....
-- modified at 21:36 Saturday 3rd September, 2005
|
|
|
|
|
I get a fatal error from an article posted on here.
http://www.codeproject.com/w2k/makexp.asp
Here's the exact error:
http://students.etsu.edu/zbkc9/error.png[^]
I've also tried include fstream without the .h and get different errors. Any ideas? Thanks. I'm wanting to learn C++ and I have Visual Studio .NET 2003 Professional. NOt sure if the version matters, but thought I would post it in case.
|
|
|
|
|
Try
<br />
#include <fstream><br />
using namespace std;<br />
It should work without the using statment, but then you'll need to preface with std::...
std::ofstream out("blah.txt");
He is smart. He will make our Windows go.
-- modified at 21:20 Saturday 3rd September, 2005
|
|
|
|
|
<fstream.h> is not part of the C++ standard, and should not be used in any new code.
It's not portable to modern compilers like VC++ 7.x
Should use <fstream> which is part of the C++ standard, and then use using namespace std, or prefix your types with std::
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Hi all!
I'm searching a way to use the sql limit statement in my recordset (derived from CRecordset). Someone knows a way to do so?
In deep love
maTzeLein
|
|
|
|
|
Hi All
After running the program when I saw memory usage of this program in "Task Manager" then noticed that memory usage by program is continually increasing,
Though I am not doing any activity on the program.
Why is this taking place ?
Please reply
Thanks
|
|
|
|
|
Hello,
You probably got a memory leak somewhere in a function that gets called frequently!
You can use Visual Leak Detector[^] tp track any of these leaks down in a debug build. Run the program in the debugger and on exit, it will report all leaks in your program.
Is your program multithreaded by the way?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi
I am hooking into createfile API to differentiate between File open and File create . I am not ablt to differnetiate between the two operations.
In win2000 , CREATE_NEW is not at called and it is always giving OPEN_EXISTING .Further if i create a notepad file i am getting CREATE_ALWAYS . But if i create a .xls file i am getting OPEN_EXISTING
In win2003 , I am able to differentiate between Creation and open.
|
|
|
|
|
I don't know if here is the right place for this question.
I'm creating a setup project in Visual Studio .Net and i want to register a file type (say .jk) with a custom icon. In VS enviroment the only way to do this (i think) is to associate the file type with an executable. But this is not my case. I want the file .jk just to have my icon and nothing more. As you know there are files in Windows that display custom icons but are not associated with executables, so when you double click them you get a shell "Open With" dialog.
Any ideas how to deal with this?
|
|
|
|