|
I can comment on it now, it was a fine post.
I implemented your revised edition, and liked it better, because I wasn't using the new statement for each record.
It worked great, thank you very much.
I ended up deleting the whole thing, and took the gui (hwnd)to the ODBC function. The ODBC function created pointers to buffers, that were held by the SQLHandle. The first array record was fine, but records after that were corrupted.
So I have to rethink how this would work in ODBC, Which is another subject. I'm thinking that I need to implement your version of the array inside the ODBC Function itself.
The code below was a bad idea. I tried using the array directly in the GetData, but I wasn't able to use the size in the array elements. Anyways, that's a different subject.
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS) {
INT i = 0;
INT pzUserID; <- This should of been an array element
WCHAR pzFirstName[cbFirstName]; <- This should of been an array element
WCHAR pzLastName[cbLastName]; <- This should of been an array element
WCHAR pzUserName[cbUserName]; <- This should of been an array element
while (SQLFetch(hstmt) == SQL_SUCCESS) {
SQLGetData(hstmt, 1, SQL_C_ULONG, &pzUserID, 0, NULL );
SQLGetData(hstmt, 2, SQL_C_WCHAR, &pzFirstName, cbFirstName, NULL );
SQLGetData(hstmt, 3, SQL_C_WCHAR, &pzLastName, cbLastName, NULL );
SQLGetData(hstmt, 4, SQL_C_WCHAR, &pzUserName, cbUserName, NULL );
}
|
|
|
|
|
Hello,
Im writing an MFC App,
I want to create some threads using the CreateThread function.
The function that i send as a parameter to the createThread function must be declared as static and then i cant reference none static members of my object,how can i by pass it?
Thanks
|
|
|
|
|
You can still pass an object reference to a static function.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
something like this:
int CMyClass::staticFunc(void *p)
{
CMyClass *pObj = (CMyClass *)p;
...
return 0;
}
void CMyClass::someFunc()
{
CreateThread(NULL, 0, staticFunc, (void *)this, ... );
}
|
|
|
|
|
Why cast the object to a void * and the back to a CMyClass * ?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
not sure i understand the question.
threadprocs take a void* param...
|
|
|
|
|
Sorry, I mis-read what you had posted; I was thinking of something else I suspect.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
If you're using MFC, you should rather use the AfxBeginThread()[^] call that MFC provides to create thread. There are many good reasons to this, mainly that MFC has its own storekeeping mechanism that you'll bypass if you call a windows API instead of the MFC call to create thread. Likewise, use _beginthreadex()[^] otherwise. There should be basically no good reason for you to call CreateThread() directly.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Have also a look at Newcomer's assays:"Threads and Processes series".
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, I am new to this forum, but have been messing with programming for years. I have worked only a couple of computer jobs over the years, one after I completed a Novell Netware cert course (yeah, I know, dinosaur. lol) and one for a fella who wrote billing software code in C. My main employ has been in the remodeling trades and that has been why I have been in and out of this. (had to take care of my family, of course). But now I really want to get serious about this as it is really what I love.
I have spent more time learning C than anything else. I dont know C++ very well yet and I really haven't written any apps in either langs as yet.
I see that C# is the hot language now unless I am mistaken and my main question is: what should I concentrate my efforts on? Should I just write and debug as much as I can in what I know to hone my skills? Should I abandon C altogether and concentrate on C# specifically? And as far as finding work, should I frequent the bidding sites and post myself if I think I can do the job?
I know you all have 'been there' so any advice would be welcome.
THanks!
Dave
|
|
|
|
|
Why didn't you write apps? You should do it.
The following is just my own personal opinion:
I think you may find C jobs only if you wish to program for microcontrollers and C++ jobs are usually harder to find than C# ones. If you really love native programming languages then, study (and master) C/C++ but you should know you'll have to deal with a rather niche market.
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]
|
|
|
|
|
Thanks for the quick reply. Yeah, that is about what I thought. But should I just move to C# to make myself more marketable? Or do I need to master C++ first?
And to writing apps, I guess I haven't done it due to a combination of laziness and lack of commitment. But that is going to change...after all, it IS the New Year!
|
|
|
|
|
In my opinion you don't need to master C++ for moving to C# (moreover if you master C++ then probably you won't move to C# ). So if you really like native languages then go on with C++ . If you want to be 'more marketable' (or simply because you wish to learn a more 'evolving' language) go on with C# . And, of course, good luck!
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]
|
|
|
|
|
Hmmm,
Any idea where all of these managed applications are? I have about 1500 software packages installed on various PC workstations/servers... (13 workstations and 3 servers) and only a small fraction (about 7%) of them are .NET managed applications. Its not like I am downloading native applications on purpose... its just that nearly everything I have seems to be implemented in a native language. (I perform routine security scans and collect PE image metrics from all workstations/servers.)
Not really looking to enter a debate...Recently I've just been curious which large software companies are developing and distributing .NET managed software applications. Most of the major software I have from Adobe, Google, Apple, IBM, Qualcomm, Intel, VMware... is all native code. I replaced the Adobe PDF Reader on all of the workstations with the Foxit PDF reader... and it turns out to be native too. Even most of the day-to-day tools I am using like Putty,Immunity Debugger,WinDbg,Wireshark/WinPcap, Textpad, notepad++,Nero,VMware, OpenVPN and Subversion... are all native code.
Of the small fraction of managed applications that I do I find on my network... many of them are actually from Microsoft Corporation.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: Any idea where all of these managed applications are?
I really don't know. But, at least here in Italy, it is far more easy to find a .NET job than a C++ one. So that was my personal two-cents bet about finding a job.
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]
|
|
|
|
|
Yeah, I am guessing that there must be hundreds of thousands of small businesses around the world that create in-house database software and other types of managed applications for their internal requirements. I have also noticed that there seems to be more managed jobs being listed these days.
Best Wishes,
-David Delaune
|
|
|
|
|
That was exactly my point.
In any case it would be an advantage for him if other people, like you, give more enlighting.
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]
|
|
|
|
|
It certainly seems that way to me, but, then again how can I tell if an app is .NET managed software? Also, I've heard that .NET software is slower than apps written in native/compiled code.
BTW, if this is the wrong forum for this discussion, admin pls move.
|
|
|
|
|
Usually 'code speed' of C++ is better than C# one.
Usually 'code development speed' of C# is better than C++ one.
BTW don't argue about these arguments at the pub or your life will be in serious danger.
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]
|
|
|
|
|
|
DragonHeart335 wrote: if this is the wrong forum for this discussion
Strictly speaking this discussion belongs in The Lounge[^], as this forum is for C++ technical issues. However, as you are new to the site you are given a bit of leeway.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
C# is likely to get you into programming for a living faster than C++.
The C++ market is good for me right now, but I've been doing C/C++ since the 1980s.
It was a tough market seven years ago, but evidently my competitors moved to C# and left a vacuum...
But still my advice stands, in C# I think you're more likely to find work at a trainee level, which will get you working for a paycheck.
|
|
|
|
|
Your first mistake is to ask the question in this forum, as all the answers will be based on our personal experiences and locality. What you really should spend time doing is looking at the job market in your local area to see what the requirements are. Employment agencies will sometimes also have some useful information to help you. Forget worrying about what is the latest hot language and concentrate on what employers are looking for.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Well, that is actually my goal. The job boards for this area show a variety of requirements from SQL, C++ to PHP, etc. for web design. It seems like alot of the government-related jobs require .NET experience.
I know everyone's experiences are unique to them, but I have been 'out of the game' for a long time and asking questions of people who are obviously doing it for a living gives me a 'feel' for the market. Thanks for all of the replies. They have been a tremendous help.
|
|
|
|
|
I can see why governments want C#: they rarely care about performance, but they do want tools to automate work, and they want them now, not in two years.
Until now I've succesfully avoided C#, but I talk to C# developers all the time. I gathered that developing Windows applications, especially the UI and database parts, is considerably faster than anything you could put together with C++. That said, .NET means you're stuck with Windows and MS. Keep in mind when making your decision that you will be marrying Windows and MS together with the technology, for all the good or bad that brings. That may be of no consequence in the short run, but if MS ever moves it's focus - and Windows 8 (Metro) looks like they might - then demand for C# may drop. (just an uneducated guess - there's too little information yet to be sure)
|
|
|
|
|